Android Question How to use the night in style google maps?

Erel

B4X founder
Staff member
Licensed User
Longtime User
upload_2016-11-10_16-51-28.png


Step 1: Update Google Repository in Android SDK Manager.
Step 2: Copy the json text: https://developers.google.com/maps/documentation/android-api/styling and put it in a file named style.txt.
Step 3:
B4X:
Sub MapFragment1_Ready
  gmap = MapFragment1.GetMap
  Dim jo As JavaObject = gmap
  Dim style As JavaObject
  style.InitializeNewInstance("com.google.android.gms.maps.model.MapStyleOptions", Array(File.ReadString(File.DirAssets, "style.txt")))
  Log(jo.RunMethod("setMapStyle", Array(style))) 'returns True if successful
End Sub
 
Upvote 0

AlexMaa

Member
Licensed User
Longtime User
Error occurred on line:

java.lang.ClassNotFoundException: com.google.android.gms$maps$model$MapStyleOptions
 
Upvote 0

devmobile

Active Member
Licensed User
View attachment 49907

Step 1: Update Google Repository in Android SDK Manager.
Step 2: Copy the json text: https://developers.google.com/maps/documentation/android-api/styling and put it in a file named style.txt.
Step 3:
B4X:
Sub MapFragment1_Ready
  gmap = MapFragment1.GetMap
  Dim jo As JavaObject = gmap
  Dim style As JavaObject
  style.InitializeNewInstance("com.google.android.gms.maps.model.MapStyleOptions", Array(File.ReadString(File.DirAssets, "style.txt")))
  Log(jo.RunMethod("setMapStyle", Array(style))) 'returns True if successful
End Sub
How restore map style to default style?
 
Upvote 0

Similar Threads

Top