public void OnMapReady(HuaweiMap map) { hMap = map; hMap.UiSettings.CompassEnabled = true; hMap.UiSettings.MyLocationButtonEnabled = true; hMap.MapType = HuaweiMap.MapTypeNormal; hMap.MoveCamera(CameraUpdateFactory.NewLatLngZoom(new LatLng(48.893478, 2.334595), 10)); StreamReader strm = new StreamReader(Assets.Open("mapstyle_greeen.json")); string response = strm.ReadToEnd(); var isLoad = hMap.SetMapStyle(MapStyleOptions.LoadAssetResouceStyle(response)); }
public bool OnNavigationItemSelected(IMenuItem item) { try { StreamReader strm = new StreamReader(Assets.Open("mapstyle_light.json")); switch (item.ItemId) { case Resource.Id.navigation_map_1: strm = new StreamReader(Assets.Open("mapstyle_light.json")); break; case Resource.Id.navigation_map_2: strm = new StreamReader(Assets.Open("mapstyle_night.json")); break; default: strm = new StreamReader(Assets.Open("mapstyle_light.json")); break; } string response = strm.ReadToEnd(); var isLoad = hMap.SetMapStyle(MapStyleOptions.LoadAssetResouceStyle(response)); if (isLoad) { return(true); } else { Toast.MakeText(this, "Sorry, selected theme not loading right now", ToastLength.Long); return(false); } } catch (Exception ex) { Toast.MakeText(this, "Sorry, selected theme not loading right now", ToastLength.Long); return(false); } }