Android Question felUSBSerial

Discussion in 'Android Questions' started by Victor Pavlov, Jan 16, 2018.

  1. Victor Pavlov

    Victor Pavlov Member Licensed User

    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?
     
  2. DonManfred

    DonManfred Expert Licensed User

    no; Initialize initializes and opens the Serial.
     
  3. Victor Pavlov

    Victor Pavlov Member Licensed User

    What does the IsInitialized property show?
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    IsInitialized will still be True after you call Close. You should initialize it again if you want to reuse it.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice