james_sgp Active Member Licensed User Longtime User Sep 18, 2019 #1 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
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
Erel B4X founder Staff member Licensed User Longtime User Sep 18, 2019 #2 Please post error messages as text. Right click to copy. My guess is that the original data includes null values. You will need to convert them to empty strings before they are added to B4XTable. Upvote 0
Please post error messages as text. Right click to copy. My guess is that the original data includes null values. You will need to convert them to empty strings before they are added to B4XTable.
james_sgp Active Member Licensed User Longtime User Sep 18, 2019 #3 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
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.
Erel B4X founder Staff member Licensed User Longtime User Sep 18, 2019 #4 You can use the coalesce method to convert nulls to other values inside the query: https://www.sqlite.org/lang_corefunc.html#coalesce Upvote 0
You can use the coalesce method to convert nulls to other values inside the query: https://www.sqlite.org/lang_corefunc.html#coalesce
james_sgp Active Member Licensed User Longtime User Sep 18, 2019 #5 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
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
james_sgp Active Member Licensed User Longtime User Sep 19, 2019 #6 Ok, the error was as Erel had predicted...there was NULL values in my table data. Awesome advice, thanks. Upvote 0
Ok, the error was as Erel had predicted...there was NULL values in my table data. Awesome advice, thanks.