We’re introducing runtime styling in the upcoming release of our Android SDK. Runtime styling gives developers a new level of customization and a toolbox to design experiences directly in their code. Now you can adjust the color of a map to the local time of day, change text labels based on localization settings on the device, or use a heat-map to change the color of buildings on the fly.

While we’re polishing the final release, here’s a preview of some of the magic available in our current beta.

Indoor maps

Runtime styling allows you to add, remove, or modify map layers on the fly, offering new ways to present data on a map. For this demo, we mapped out the interior of The White House, saved in a GeoJSON file. Here’s how you add the data as a source to the map and create a layer from the data:

// Load in the GeoJSON file and add as a new source.
indoorBuildingSource = new GeoJsonSource("indoor-building", <load GeoJSON here>);

FillLayer indoorBuildingLayer = new FillLayer("indoor-building-fill", "indoor-building").withProperties(
  // Function.zoom is used here to fade out the indoor layer if zoom level is beyond 16. Only
  // necessary to show the indoor map at high zoom levels.
    stop(17, fillOpacity(1f)),
    stop(16.5f, fillOpacity(0.5f)),
    stop(16, fillOpacity(0f))



Now add different data sources for each floor level to modify the map whenever a user selects a different floor:

Highlight map features

This example lets the user explore parks, hotels and attractions in Los Angeles. Runtime styling allows you to customize the look of existing layers in the map style. To keep the map neat and informative, users simply toggle the layers they are interested in. The pulsing animation of a layer being toggled on or off is the result of using a ValueAnimator, typically used in Android:

final FillLayer parks = (FillLayer) mapboxMap.getLayer("parks");

parkColorAnimator = ValueAnimator.ofObject(
  new ArgbEvaluator(),
  Color.parseColor("#7ac79c"), // Brighter shade
  Color.parseColor("#419a68") // Darker shade
parkColorAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {

  public void onAnimationUpdate(ValueAnimator animator) {

      fillColor((int) animator.getAnimatedValue())

Next to runtime styling, the upcoming Android SDK release lets you query the map to get features, cluster GeoJSON markers, and improves map performance and stability.

Ready to put runtime styling to the test? Get started by downloading our demo application or update your Mapbox dependency to 4.2.0-beta.5.