我用了CH340usb转串口芯片连接安卓的otg手机,在安卓系统上使用了CH34xUart_Android 这个库文件接口,现在我能使用里面的UsbFeatureSupported和SetTimeOut函数,但是用到EnumerateDevice或ResumeUsbList时,系统就会报错:
java.lang.RuntimeException:Can't create handle inside thread that has not called Looper.prepare()
我用的编程软件是C++ Builder XE10,我是在程序的按钮事件中调用的EnumerateDevice,应该是没错的吧,另外,我实例化CH34xUARTDriver的方法是:
?_di_JCH34xUARTDriver CH34xUARTDriver1 = TJCH34xUARTDriver::JavaClass->init(JUsbManager1,MainActivity()->getApplicationContext(),StringToJString(ACTION_USB_PERMISSION));
上面的错误不知这是什么原因引起的,有知道的人能指点下吗,恳请相助...