Android Question Unknown error

catyinwong

Active Member
Licensed User
Longtime User
I discover this error in my project for almost all modules:
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Object.equals(java.lang.Object)' on a null object reference

The funny part is that after I have put a breakpoint on the code to check for the error, nothing goes wrong (only press "play" after the breakpoint and then everything will work fine). And this error would only appears in one module, after I have given up the module, the same error pops up for randomly another module. Anyone knows why??
 
Last edited:

Pooya1

Active Member
Licensed User
You used value that is Null
Example if view.Tag dont have any value and you try get tag value,The following error given
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Object.equals(java.lang.Object)' on a null object reference
 
Upvote 0

Arthur Ávila

Member
Licensed User
I've saw almost the same issue

B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 73 (Main)
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.Object.equals(java.lang.Object)' on a null object reference
    at procob.topcar.placa.id.main._activity_create(main.java:498)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:735)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:360)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:260)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at procob.topcar.placa.id.main.afterFirstLayout(main.java:104)
    at procob.topcar.placa.id.main.access$000(main.java:17)
    at procob.topcar.placa.id.main$WaitForLayout.run(main.java:82)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:7406)
    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)
** Activity (main) Resume **

For this part of the code, lines 72-73
B4X:
For Each colrestricoes As Map In restricoes
                If Not(colrestricoes.Get(k) = "") Then

Its odd that with only a line break (just hit enter) after the "Then" the error don't show..
 
Upvote 0
Top