Android Question B4XTable gives NullPointerException when using search

james_sgp

Active Member
Licensed User
Longtime User
I have 3 B4Xtables on different layouts, 2 work perfectly, but one of the tables crashes my app when I try to search. Any character I type into the search field gives an error:
"Error occurred on line: 449 (B4XTable)
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.String.toLowerCase()' on a null object reference" (screenshot of log below).

The table in question fills correctly (from an SQL table) and I can click on cells without a problem; it's only searching that causes a crash.

Appreciate any advice anyone can give.

James
Prod_stock_table, search error.PNG
 

james_sgp

Active Member
Licensed User
Longtime User
Erel,

I'll post the log as text, when i grt back home. But thanks for the pointer on checking for null values in the database. Thats something i need to make sure my app handles.
 
Upvote 0

james_sgp

Active Member
Licensed User
Longtime User
Erel,

Heres the error log in text...

java.lang.RuntimeException: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.String.toLowerCase()' on a null object reference
at anywheresoftware.b4a.keywords.Common$13.run(Common.java:1707)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:6986)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1445)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.String.toLowerCase()' on a null object reference
at Mobile.POS.b4xtable._settexttocell(b4xtable.java:2501)
at Mobile.POS.b4xtable$ResumableSub_ImplUpdateDataFromQuery.resume(b4xtable.java:1649)
at anywheresoftware.b4a.keywords.Common$13.run(Common.java:1705)
... 7 more
 
Upvote 0

james_sgp

Active Member
Licensed User
Longtime User
Ok, the error was as Erel had predicted...there was NULL values in my table data.
Awesome advice, thanks.
 
Upvote 0
Top