This commit is contained in:
Petr Pokorny
2021-07-28 21:06:25 +02:00
committed by GitHub
parent 57b968c255
commit 2a86dcefc0
2 changed files with 16 additions and 10 deletions

View File

@@ -9,6 +9,7 @@ import com.mapbox.mapboxsdk.maps.MapView;
import com.mapbox.mapboxsdk.maps.Style;
import com.mapbox.mapboxsdk.testapp.R;
import com.mapbox.mapboxsdk.testapp.utils.NavUtils;
import com.mapbox.mapboxsdk.util.DefaultStyle;
/**
* Test activity showcasing a simple MapView without any MapboxMap interaction.
@@ -23,9 +24,13 @@ public class SimpleMapActivity extends AppCompatActivity {
setContentView(R.layout.activity_map_simple);
mapView = findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(mapboxMap -> mapboxMap.setStyle(
new Style.Builder().fromUri(Style.getPredefinedStyle("Streets"))
));
mapView.getMapAsync(mapboxMap -> {
DefaultStyle[] styles = Style.getPredefinedStyles();
if (styles != null && styles.length > 0) {
String styleUrl = styles[0].getUrl();
mapboxMap.setStyle(new Style.Builder().fromUri(styleUrl));
}
});
}
@Override