Android Question Googlemap Marker Can Not Be Initialized

Ganiadi

Active Member
Licensed User
Longtime User
Dear All,
Please help, where i got and error said that "LatLng Should be initialized"
I dont know how to initialize m1. i Found isInitialized but can not find initialize

Error:
m1 = gmap.AddMarker3(gmap.MyLocation.Latitude,  gmap.MyLocation.Longitude, "", SetBitmapDensity(LoadBitmap(File.DirAssets, "car.png")))

Pls advice

Below is the code

Marker Can Not Be Initialized:
Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Mapfr")
    Wait For MapFR_Ready   
    gmap = MapFR.GetMap
        
    rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
    Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
    If MapFR.IsGooglePlayServicesAvailable = False Then
        ToastMessageShow("Please install Google Play Services.", True)
        
    End If
    Try
        If Result Then
            gmap.GetUiSettings
            gmap.MyLocationEnabled = True
            m1 = gmap.AddMarker3(gmap.MyLocation.Latitude,  gmap.MyLocation.Longitude, "", SetBitmapDensity(LoadBitmap(File.DirAssets, "car.png")))
            Dim CameraPosition1 As CameraPosition
            CameraPosition1.Initialize(m1.Position.Latitude, m1.Position.Longitude, 18)
            CameraPosition1 = gmap.CameraPosition
            gmap.AnimateCamera(CameraPosition1)
            m1.Visible = True
        Else
            Log("No permission!")
        End If
    Catch
        Log("ERROR" & LastException.Message)
    End Try
End SUb
 

DonManfred

Expert
Licensed User
Longtime User
1. Please post the FULL ERROR.
2. The own Location is NOT immediately available after you enable MyLocationEnabled
 
Upvote 0
Top