I have encountered a problem when loading Google Maps on Android 6.0
Error:
B4X:
Sub btnNearest_Click
Dim Lat As Double
Dim Lon As Double
Lat = -26.18586111
Lon = 28.03805556
Dim MarkerText As String = "Provincial Commissioner"
Dim ExtraText As String = "16 Empire Rd. Parktown"
gmap = MapFragment1.GetMap
Dim m1 As Marker = gmap.AddMarker(Lat, Lon, MarkerText) <<---Error Here
Dim CameraPosition1 As CameraPosition
CameraPosition1.Initialize(Lat, Lon, 17)
gmap.AnimateCamera(CameraPosition1)
m1.Snippet = ExtraText
pnlMap.Visible = True
End Sub
B4X:
Map is not ready yet.
Error occurred on line: 314 (Main)
java.lang.RuntimeException: Object should first be initialized (GoogleMap).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:50)
at anywheresoftware.b4a.objects.MapFragmentWrapper$GoogleMapWrapper.AddMarker(MapFragmentWrapper.java:262)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:708)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:337)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:157)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:153)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:78)
at android.view.View.performClick(View.java:5210)
at android.view.View$PerformClick.run(View.java:21183)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5452)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:762)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:652)