Android Question Google map is never initialized if used with B4XDrawer (Drawer.CenterPanel.LoadLayout)

Daica

Active Member
Licensed User
I am using B4XDrawer and and I load my layout file with the MapFragment on it by using
Drawer.CenterPanel.LoadLayout

However, if I do it this way, Google Map is never initialize and I am stuck with a map that has no location.

If I use
Activity.LoadLayout
then the MapFragment will initialize just fine.

Anyone else have this problem?
 

Daica

Active Member
Licensed User
Can you upload the project? Don't forget to remove your API key.

Here you go Erel:

The upload is "too big" (1MB) to be uploaded.

Thank you

EDIT:
I should mention that I've tried both real device and emulator, in both debug and release mode.
The emulator always has GPS enabled.

If I take away the B4XDrawer part and just have a layout with only Gmap and load it using Activity.Load(""), it will work fine
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I took this example: https://www.b4x.com/android/forum/threads/b4x-b4xpages-googlemaps-example.120121/#content

Change B4XPage_Created to:
B4X:
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Dim drawer As B4XDrawer
    drawer.Initialize(Me, "drawer", Root, 200dip)
    drawer.CenterPanel.LoadLayout("MainPage")
    btnJumpToParis.Enabled = False
    Wait For (InitializeMap) Complete (Success As Boolean)
    MapReady = Success
    If MapReady Then
        Log("map ready")
        btnJumpToParis.Enabled = True
        gmap.AddMarker(0, 0, "Center")
    End If
End Sub
It works fine.
 
Upvote 0
Top