I get the above exception when running the below code. I call this code from multiple points so I know it works but from one point it always gives me the above exception. I can tell you with 100% certainty that A) the format of the SELECT statement is correct, B) the Main.DB is valid and that the provided parameters are present and correct. C) The database has data that corresponds to the query.
The error occurs when the line in red executes. I cannot step into the DBUtils module nor can I place a debug point in the DBUtils module and have the code pause there. The error does get caught by a Try\Catch loop but it does me no good if I can't read the data from the database.
The complete error is provided below.
The code formats poorly in the editor but both lines beginning SessionMap = DBUtils.ExecuteMap( etc all occur on a single line and do not break as shown here.
This is the complete error message.
Error occurred on line: 973 (Score_)
java.lang.NullPointerException: Attempt to read from field 'anywheresoftware.b4a.BA$SharedProcessBA anywheresoftware.b4a.BA.sharedProcessBA' on a null object reference
at anywheresoftware.b4a.B4AClass$ImplB4AClass.getActivityBA(B4AClass.java:20)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:668)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:334)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:244)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:132)
at anywheresoftware.b4a.BA$2.run(BA.java:299)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
(Exception) java.lang.Exception: java.lang.reflect.InvocationTargetException
Your help is appreciated as this seems to be an exception in the BA$SharedProcessBA
The error occurs when the line in red executes. I cannot step into the DBUtils module nor can I place a debug point in the DBUtils module and have the code pause there. The error does get caught by a Try\Catch loop but it does me no good if I can't read the data from the database.
The complete error is provided below.
B4X:
Sub Get_Most_Recent_Score(Mode As Int, LastRallyEnd As Int, RestoreScore As Boolean) As Boolean
Dim tmpScoreHistory As String
Dim SessionMap As Map
SessionMap.Initialize
Select Case Mode
Case 1 'ShotRecorder
SessionMap = DBUtils.ExecuteMap(Main.DB, "SELECT * FROM SESSION WHERE SessionNumber = ? AND ShotNumber = ?", Array As String(Main.SMR.SessionNumber, LastRallyEnd))
Case 2 'ScoreKeeper
SessionMap = DBUtils.ExecuteMap(Main.DB, "SELECT * FROM SK_SESSION WHERE SessionNumber = ? AND ShotNumber = ?", Array As String(Main.SK_SMR.SessionNumber, LastRallyEnd))
End Select
........
End Sub
The code formats poorly in the editor but both lines beginning SessionMap = DBUtils.ExecuteMap( etc all occur on a single line and do not break as shown here.
This is the complete error message.
Error occurred on line: 973 (Score_)
java.lang.NullPointerException: Attempt to read from field 'anywheresoftware.b4a.BA$SharedProcessBA anywheresoftware.b4a.BA.sharedProcessBA' on a null object reference
at anywheresoftware.b4a.B4AClass$ImplB4AClass.getActivityBA(B4AClass.java:20)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:668)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:334)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:244)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:132)
at anywheresoftware.b4a.BA$2.run(BA.java:299)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
(Exception) java.lang.Exception: java.lang.reflect.InvocationTargetException
Your help is appreciated as this seems to be an exception in the BA$SharedProcessBA