Android Question Change MapType and lose Map_CameraChange event == Solved

Discussion in 'Android Questions' started by Roger Daley, May 23, 2015.

  1. Roger Daley

    Roger Daley Well-Known Member Licensed User

    Hi All,

    Problem solved. I was using incorrect method to change map type. Changed code below.

    Next GoogleMap question. When I change the map type with the code below the Map_CameraChange event is no longer fired. Everything is working OK until then, it doesn't matter if the change is from road map to satellite or vice versa. If I restart the app all is back to normal.

    I've done the usual searches but the solution still escapes me.

    Sub BtnMapType_click
    If MapTypeInt = 1 Then
            MapTypeInt = 
    4                            'Change map to satellite with labels for locations and roads etc.
            'BtnMapType.Text = "Road Map"
            MapTypeInt = 
    1                            'Change map to standard road map 
            'BtnMapType.Text = "Satellite"
        End If
        MapZoom = gmap.CameraPosition.Zoom
        MapBearing = gmap.CameraPosition.Bearing
        MapCenter = gmap.CameraPosition.Target
        MapLat = MapCenter.Latitude
        MapLng = MapCenter.Longitude
       gmap.maptype = MapTypeInt       
    'Regenerate map with new map type.
       ' mFragment.Initialize("Map", MapPanel)        'Incorrect method that caused problem
    End Sub
    Regards Roger
    Last edited: May 23, 2015
    eurojam likes this.