hi¡
im an error when i try to stop a service.
my code is the next.
the code of "reiniciarTarjetas sensores" is:
more code:
and connectUSBsensorDevices start service another time.
the error that i have is the next:
im an error when i try to stop a service.
my code is the next.
B4X:
If IsPaused(Main)=False Then
Log("llamamos a reinicio de tarjeta del main")
CallSubDelayed3(Main,"reiniciarTarjetasSensores",callActivity,event)
End If
the code of "reiniciarTarjetas sensores" is:
B4X:
Sub reiniciarTarjetasSensores(callActivity As Object,event As String)
usbDevices.CloseUSBSensorDevices
usbDevices.ConnectUSBSensorDevices(callActivity,event)
End Sub
more code:
B4X:
Sub CloseUSBSensorDevices
Try
StopService(usbServiceSensor)
Catch
End Try
End Sub
and connectUSBsensorDevices start service another time.
the error that i have is the next:
B4X:
** Service (usbservicesensor) Destroy **
usbservicesensor_service_destroy (java line: 131)
java.lang.NullPointerException
at b4aSlave.example.usbservicesensor._service_destroy(usbservicesensor.java:131)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:173)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:157)
at b4aSlave.example.usbservicesensor.onDestroy(usbservicesensor.java:82)
at android.app.ActivityThread.handleStopService(ActivityThread.java:2389)
at android.app.ActivityThread.access$2000(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1213)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
java.lang.RuntimeException: Unable to stop service b4aSlave.example.usbservicesensor@410b7308: java.lang.RuntimeException: java.lang.NullPointerException
at android.app.ActivityThread.handleStopService(ActivityThread.java:2406)
at android.app.ActivityThread.access$2000(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1213)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:199)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:157)
at b4aSlave.example.usbservicesensor.onDestroy(usbservicesensor.java:82)
at android.app.ActivityThread.handleStopService(ActivityThread.java:2389)
... 10 more
Caused by: java.lang.NullPointerException
at b4aSlave.example.usbservicesensor._service_destroy(usbservicesensor.java:131)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:173)
... 13 more