Android Question Google Maps Position without animated

mojako

Member
Licensed User
Dear All,

I'm following this Tutorial to view my position in Google Map.
it is run good and smoothly, but something i want to change is how to make my map show my location when first time the map renders.
currently tutorial draw all world map then animated to where my position marked..
I want to do is :
1. static point my map and marked my position without animated first from world map.
2. no animated point and no world map, just render my position.

thanks
 

mojako

Member
Licensed User
yes Erel,

you're right,... I'm using MoveCamera rahter than AnimateCamera, but when the map render, world map still show event for not too long..
that's still make me curious..
 
Upvote 0

mojako

Member
Licensed User
yes Erel,

this is issue for our user.. "hide the map and show it after seconds", would you give a sample..
the best way for me could be, "hide the map, and show the map after gmap get actual GPS long lat"... and for this can you give us sample code ..

thanks
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Put MapFragment in a panel named Panel1. Both views should be anchored to both sides.

Requires B4A v7:
B4X:
Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("1")
   Panel1.Visible = False
   If gmap.IsInitialized = False Then
     Wait For MapFragment1_Ready
     gmap = MapFragment1.GetMap
   End If
   ProgressDialogShow2("Waiting for location...", True)
   WaitForFirstLocation
End Sub

Sub WaitForFirstLocation
   Do While gmap.MyLocation.IsInitialized = False
     Sleep(500)
   Loop
   Dim cp As CameraPosition
   cp.Initialize(gmap.MyLocation.Latitude, gmap.MyLocation.Longitude, 10)
   gmap.MoveCamera(cp)
   Panel1.Visible = True
   ProgressDialogHide
End Sub

Sub Activity_Resume
   If gmap.IsInitialized And Panel1.Visible = False Then WaitForFirstLocation
End Sub
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0
Top