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: 82
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

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):
There is some issue in the library, i think...
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…