My app is a kiosk app (not sure if this makes a difference.)
I have two Activities in my app. When I execute StartActivity(WiFiConnect) to open another activity, the first activity is throwing a NullPointerException when StateManager.SaveState(Activity,"Main") is executed.
Here is the code:
Here is the exception thrown:
I have two Activities in my app. When I execute StartActivity(WiFiConnect) to open another activity, the first activity is throwing a NullPointerException when StateManager.SaveState(Activity,"Main") is executed.
Here is the code:
B4X:
Sub btnWiFiConnect_Click
StartActivity(WiFiConnect)
End Sub
Sub Activity_Pause (Finishing As Boolean)
Try
If kiosk Then StartServiceAt(KioskService, DateTime.Now + 1 * DateTime.TicksPerSecond, False)
If Finishing Then
StateManager.ResetState("Main")
Else
StateManager.SaveState(Activity, "Main")
End If
StateManager.SaveSettings
Catch
Ex = LastException
cErrorLog.InsertLog(3,"CustomerTablet.Main.Activity_Pause",Ex.Message)
If DebugMode Then
Log(Ex.StackTraceElement(0))
End If
End Try
End Sub
Here is the exception thrown:
B4X:
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
Error occurred on line: 663 (main)
java.lang.NullPointerException
at b4a.CustomerTablet.main._activity_pause(main.java:1059)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:636)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:305)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:238)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:121)
at anywheresoftware.b4a.ShellBA$2.run(ShellBA.java:103)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4921)
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:1038)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
at dalvik.system.NativeStart.main(Native Method)