Android Question Google Map question

grafsoft

Well-Known Member
Licensed User
Longtime User
With this code

B4X:
Private Sub MapFragment1_Click (Point As LatLng)
    gmapp.AddMarker(Point.Latitude, Point.Longitude, "Markierung")
End Sub

the user can add markers and when he taps the marker, he can ask for directions (lower right corner, left symbol) or search for any place (lower right corner, right symbol). The user will not know this before he/she tries it out.

I would like to have the right symbol - search places - permanently on the screen.

Is there a method to achieve that?
 

Attachments

  • Screenshot_20221014-110930_2.jpg
    Screenshot_20221014-110930_2.jpg
    249.6 KB · Views: 138
Solution
Other
B4X:
Public Sub ShowPointsInMap(Latitude As Double, Longitude As Double)
    Dim GoogleMapIntent As Intent
    GoogleMapIntent.Initialize(GoogleMapIntent.ACTION_VIEW, $"http://maps.google.com/maps?q=${Latitude},${Longitude}"$)
    GoogleMapIntent.SetComponent("android/com.android.internal.app.ResolverActivity")
    StartActivity(GoogleMapIntent)
End Sub

grafsoft

Well-Known Member
Licensed User
Longtime User
Sorry, I just found the answer myself. The press on the symbols just calls Google Maps. I cannot delete my question ... sorry.
 
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
? true or false
B4X:
    'Set UiSetting
    GoogleMaps1.GetUiSettings.As(JavaObject).RunMethod("setMapToolbarEnabled", Array As Object(False))
 
Upvote 0

grafsoft

Well-Known Member
Licensed User
Longtime User
Ah, this is much better than what I did. My "solution" was just a workaround.

I just put a button with a map-symbol on the map and then

B4X:
private Sub Bmap_Click
    Dim p As PhoneIntents
    StartActivity(p.OpenBrowser("http://maps.google.com/?q=" & mypoint.Latitude & "," & mypoint.Longitude))
   ' mypoint is the center of the map displayed or the position of the last marker set
End Sub
 
Last edited:
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
Other
B4X:
Public Sub ShowPointsInMap(Latitude As Double, Longitude As Double)
    Dim GoogleMapIntent As Intent
    GoogleMapIntent.Initialize(GoogleMapIntent.ACTION_VIEW, $"http://maps.google.com/maps?q=${Latitude},${Longitude}"$)
    GoogleMapIntent.SetComponent("android/com.android.internal.app.ResolverActivity")
    StartActivity(GoogleMapIntent)
End Sub
 
Upvote 0
Solution

grafsoft

Well-Known Member
Licensed User
Longtime User
Other
B4X:
Public Sub ShowPointsInMap(Latitude As Double, Longitude As Double)
    Dim GoogleMapIntent As Intent
    GoogleMapIntent.Initialize(GoogleMapIntent.ACTION_VIEW, $"http://maps.google.com/maps?q=${Latitude},${Longitude}"$)
    GoogleMapIntent.SetComponent("android/com.android.internal.app.ResolverActivity")
    StartActivity(GoogleMapIntent)
End Sub
Thank you! This is EXACTLY what I wanted!
 
Upvote 0
Top