android xamarin google MapFragment.Map is null -
In XMERIA Android, the code shows map to create mapfraagment, but mapFragment.Map is always empty and I set the map Can not type
code:
var mapFragment = MapFragment.NewInstance (mapOptions); Piece Transactions Tx = Fragment Manager Begit transactions (); Tx.Add (resource.indemap_frames_container, mapfragment); Map = mapFragment.Map; If (map! = Null) {map.MapType = GoogleMap.MapTypeNormal; // this never comes to the line} tx Comet ();
xml:
The reason for this was that the map view was not created at the time of calling
> P>
var mapFragment = MapFragment.New instances (mapOptions);
Therefore IFragment.Map; delayed 500 milliseconds before using the map;
handler Post delimited (updatemap, 500); Zero UpdateMap () {map = mapFragment.Map; If (map! = Null) {map.MapType = GoogleMap.MapTypeNormal; Map.MoveCamera (cameraUpdate); Return; } Handler. Post deliid (updatemap, 500); }
Comments
Post a Comment