Android Question AS_Settings error

Jerryk

Active Member
Licensed User
Longtime User
I had a working page with the AS Settings component. I upgraded to the latest version 2.18 and now it's crashing my application. Specifically on the SettingPage2.ShowPage command. In debug mode, the SettingPage2 page shows for a moment, disappears, and then the application crashes.

B4X:
SettingPage2.Initialize(AS_Settings1, lc("adv_settings"))
SettingPage2.AddGroup("Page2", lc("PRO_features"))
SettingPage2.AddProperty_Action("Page2", "export", lc("export_course"), lc("export_course_d"), Null, "")
SettingPage2.AddProperty_Action("Page2", "import", lc("import_course"), lc("import_course_d"), Null, "")
SettingPage2.AddProperty_Action("Page2", "delete", lc("delete_course"), lc("delete_course_d"), Null, "")

......
SettingPage2.ShowPage
B4X:
Error occurred on line: 1448 (AS_SettingsPage)
java.lang.NullPointerException: Attempt to invoke virtual method 'int anywheresoftware.b4a.objects.B4XViewWrapper.getHeight()' on a null object reference
    at cz.flashcards3000.as_settingspage._addinternproperty(as_settingspage.java:2292)
    at cz.flashcards3000.as_settingspage._xclv_main_visiblerangechanged(as_settingspage.java:4861)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:348)
    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$2.run(BA.java:395)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:223)
    at android.app.ActivityThread.main(ActivityThread.java:7743)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Error occurred on line: 1448 (AS_SettingsPage)
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[])' on a null object reference
    at anywheresoftware.b4a.shell.Shell.runGoodChain(Shell.java:479)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:293)
    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$2.run(BA.java:395)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:223)
    at android.app.ActivityThread.main(ActivityThread.java:7743)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Error occurred on line: 1448 (AS_SettingsPage)
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[])' on a null object reference
    at anywheresoftware.b4a.shell.Shell.runGoodChain(Shell.java:479)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:293)
    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$2.run(BA.java:395)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:223)
    at android.app.ActivityThread.main(ActivityThread.java:7743)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
 

Jerryk

Active Member
Licensed User
Longtime User
An example of a small project where it fails.
I unpacked your library and tested on the unpacked code. The crash occurred on line 1448 in the AS_SettindPage file:
xpnl_PropertySeperator.Top = xpnl_Property.Height - xpnl_PropertySeperator.Height*2
The value of xpnl_PropertySeperator.Height in the hover window is always equal to 3, but on the last pass the value is: Error evaluating expression..This causes the crash.
 

Attachments

  • Settings.zip
    12.3 KB · Views: 28
Upvote 0
Top