Android Question B4XMap (Open Street Map) Attempt to read from field 'double' When B4XPage_Appear

mcqueccu

Well-Known Member
Licensed User
Longtime User
The B4XMap library seems to have a issue loading from B4XPage_Appear or other subroutines

When you load from B4XPage_Created, everything works fine.

This is the Error when you load from Page Appear.

B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
*** mainpage: B4XPage_Created
*** mainpage: B4XPage_Appear
** Activity (main) Resume **
Error occurred on line: 323 (cvMap)
java.lang.NullPointerException: Attempt to read from field 'double b4a.example.comaputilities$_tmaplatlng.fLat' on a null object reference
    at b4a.example.cvmap._setcenterlatlng(cvmap.java:2173)
    at b4a.example.cvmap._setmap(cvmap.java:100)
    at b4a.example.b4xmainpage._fcvmap_ready(b4xmainpage.java:142)
    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:351)
    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.keywords.Common.CallSub4(Common.java:1114)
    at anywheresoftware.b4a.keywords.Common.CallSubNew(Common.java:1061)
    at b4a.example.cvmap._loadlayout(cvmap.java:2159)
    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:351)
    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:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6669)
    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:858)
 

Attachments

  • Project.zip
    85.5 KB · Views: 14
Last edited:

PaulMeuris

Active Member
Licensed User
By putting the LoadLayout function before the loadMap call the app works... in DEBUG mode.
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
'    Root.LoadLayout("MainPage")
'    loadMap 'Loading from page created works   
End Sub
Sub B4XPage_Appear
    Root.LoadLayout("MainPage")
    loadMap 'Loading from Appear
End Sub
1714797326309.png

After a few seconds i get a response error access denied...
ResponseError. Reason: , Response: Access denied. See https://operations.osmfoundation.org/policies/tiles/
The app throws an error when run in RELEASE mode (in both situations from page_created and from page_appear subs):
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create (first time) **
*** mainpage: B4XPage_Created
*** mainpage: B4XPage_Appear
** Activity (main) Resume **
cvmap_update_centerlatlng (java line: 1601)
java.lang.Exception: Sub fcvmap_centerlatlngchanged was not found.
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:227)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:1114)
at anywheresoftware.b4a.keywords.Common.CallSubNew2(Common.java:1069)
at b4a.example.cvmap._update_centerlatlng(cvmap.java:1601)
at b4a.example.cvmap._setcenterlatlng(cvmap.java:1314)
at b4a.example.cvmap._loadlayout(cvmap.java:955)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:221)
at anywheresoftware.b4a.keywords.Common$12.run(Common.java:1212)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:7025)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
There is some issue in the library, i think...
1714797882125.png
 
Upvote 0
Top