Android Question java.lang.NullPointerException: null receiver

Declan

Well-Known Member
Licensed User
Longtime User
I keep getting the following error.
This is strange as the code worked before, now suddenly throwing the error:
Error:
B4X:
Error occurred on line: 102 (B4XMainPage)
java.lang.NullPointerException: null receiver
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runVoidMethod(Shell.java:777)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:354)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:157)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:201)
    at anywheresoftware.b4a.shell.DebugResumableSub$RemoteResumableSub.resume(DebugResumableSub.java:22)
    at anywheresoftware.b4a.BA.checkAndRunWaitForEvent(BA.java:275)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:150)
    at anywheresoftware.b4a.BA$2.run(BA.java:395)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:158)
    at android.app.ActivityThread.main(ActivityThread.java:7225)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

My Code:
B4X:
Sub getHomeDevices
    Dim friendname As String
    
    clv1.Clear <-----------------------------------------Error Here
    DB.Initialize(DBFileDir, DBFileName, True)
    Dim Cursor1 As Cursor
    Cursor1 = DB.ExecQuery("SELECT * FROM trans ORDER BY id")
    For i = 0 To Cursor1.RowCount - 1
        Cursor1.Position = i
    
        Dim Transactions As Map
        Transactions.Initialize
        Transactions.Put(1, Cursor1.GetString("id"))
        Transactions.Put(2, Cursor1.GetString("deviceid"))
        Transactions.Put(3, Cursor1.GetString("lat"))
        Transactions.Put(4, Cursor1.GetString("lon"))
        Transactions.Put(5, Cursor1.GetString("volts"))
        Transactions.Put(6, Cursor1.GetString("msgid"))
        Transactions.Put(7, Cursor1.GetString("mysignal"))
        Transactions.Put(8, Cursor1.GetString("myspeed"))
        Transactions.Put(9, Cursor1.GetString("datetime"))
        Transactions.Put(10, Cursor1.GetString("fleet"))
        Transactions.Put(11, Cursor1.GetString("friendname"))
        
        Log(Transactions.Get(1))
        
        clv1.Add(CreateListItem(Transactions, clv1.AsView.Width, 80dip), friendname )
    Next

    Cursor1.Close
End Sub
I get this error in both Debug and Release modes.
 
Top