Victor Pavlov Member Licensed User Longtime User Jan 16, 2018 #1 The statement Code: If Not(USBSerial.isInitialized) Then USBSerial.Initialize("USBSerial", MyDevice, -1) don't work correctly after Code: USBSerial.Close We get error: (NullPointerException) java.lang.NullPointerException: Attempt to invoke virtual method 'void com.felhr.usbserial.UsbSerialDevice$WorkerThread.setCallback(com.felhr.usbserial.UsbSerialInterface$UsbReadCallback)' on a null object reference The solution is to use always: Code: USBSerial.Initialize("USBSerial", MyDevice, -1) Do I make any mistake?
The statement Code: If Not(USBSerial.isInitialized) Then USBSerial.Initialize("USBSerial", MyDevice, -1) don't work correctly after Code: USBSerial.Close We get error: (NullPointerException) java.lang.NullPointerException: Attempt to invoke virtual method 'void com.felhr.usbserial.UsbSerialDevice$WorkerThread.setCallback(com.felhr.usbserial.UsbSerialInterface$UsbReadCallback)' on a null object reference The solution is to use always: Code: USBSerial.Initialize("USBSerial", MyDevice, -1) Do I make any mistake?
DonManfred Expert Licensed User Longtime User Jan 16, 2018 #2 no; Initialize initializes and opens the Serial. Upvote 0
Victor Pavlov Member Licensed User Longtime User Jan 17, 2018 #3 What does the IsInitialized property show? Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Jan 17, 2018 #4 IsInitialized will still be True after you call Close. You should initialize it again if you want to reuse it. Upvote 0
IsInitialized will still be True after you call Close. You should initialize it again if you want to reuse it.