diff --git a/src/android/Map.java b/src/android/Map.java index 3b3e7de..9ed7d8c 100644 --- a/src/android/Map.java +++ b/src/android/Map.java @@ -161,10 +161,6 @@ public void showUserLocation(boolean enabled) { } private void applyOptions(JSONObject options) throws JSONException { - if (options.has("style")) { - this.mapView.setStyleUrl(Mapbox.getStyle(options.optString("style"))); - } - if (!options.isNull("showUserLocation")) { this.showUserLocation(options.getBoolean("showUserLocation")); } diff --git a/src/android/Mapbox.java b/src/android/Mapbox.java index 99cbb8d..4076f5c 100644 --- a/src/android/Mapbox.java +++ b/src/android/Mapbox.java @@ -389,6 +389,7 @@ public void onError(String error) { private MapView createMapView(String accessToken, JSONObject options) throws JSONException { MapView mapView = new MapView(this.webView.getContext()); mapView.setAccessToken(accessToken); + mapView.setStyleUrl(Mapbox.getStyle(options.optString("style"))); final JSONObject margins = options.isNull("margins") ? null : options.getJSONObject("margins"); final int left = (int) (retinaFactor * (margins == null || margins.isNull("left") ? 0 : margins.getInt("left")));