> For the complete documentation index, see [llms.txt](https://docs.mapbox.com/android/ja/maps/llms.txt)

# Local Style MapSnapshotter

![Use an local style with static map image generation.](https://docs.mapbox.com/android/ja/assets/ideal-img/maps-examples-local-style-mapsnapshotter.b19b042.480.png)

This example demonstrates the process of creating a snapshot from a configuration that does not use a style Uniform Resource Identifier (URI) or JSON format with the **Maps SDK for Android**. The `LocalStyleMapSnapshotterActivity` class generates a snapshot of a map with a specific custom configuration.

In this example, a [`Snapshotter`](https://docs.mapbox.com/android/maps/api/latest/mapbox-maps-android/com.mapbox.maps/-snapshotter/) instance is created with specified options such as size and pixel ratio using [`MapSnapshotOptions`](https://docs.mapbox.com/android/maps/api/latest/mapbox-maps-android/com.mapbox.maps/-map-snapshot-options/). The app sets the map's camera to a specific zoom level and center coordinates, and defines a custom style directly in the code using JSON format. After starting the snapshot process, the resulting bitmap is displayed on an `ImageView` which is then set as the content view of the activity.

> **Note: Android Examples App Available**
> 
> This example code is part of the **Maps SDK for Android Examples App**, a working Android project [available on GitHub](https://github.com/mapbox/mapbox-maps-android/tree/v11.31.0/). Android developers are encouraged to run the examples app locally to interact with this example in an emulator and explore other features of the Maps SDK.
> 
> See our [Run the Maps SDK for Android Examples App](https://docs.mapbox.com/help/tutorials/maps-sdk-android-examples-app/) tutorial for step-by-step instructions.

**Kotlin**

Title: `LocalStyleMapSnapshotterActivity.kt`

[View on GitHub](https://github.com/mapbox/mapbox-maps-android/blob/v11.31.0/app/src/main/java/com/mapbox/maps/testapp/examples/snapshotter/LocalStyleMapSnapshotterActivity.kt)

```kt
package com.mapbox.maps.testapp.examples.snapshotter

import android.os.Bundle
import android.widget.ImageView
import androidx.appcompat.app.AppCompatActivity
import com.mapbox.geojson.Point
import com.mapbox.maps.*

/**
 * Activity to validate creating a snapshot from a configuration not using style URI or JSON
 */
class LocalStyleMapSnapshotterActivity : AppCompatActivity() {
  private lateinit var mapSnapshotter: Snapshotter

  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    val snapshotterOptions = MapSnapshotOptions.Builder()
      .size(Size(512.0f, 512.0f))
      .pixelRatio(1.0f)
      .build()

    mapSnapshotter = Snapshotter(this, snapshotterOptions)
    mapSnapshotter.setCamera(
      CameraOptions.Builder().zoom(14.0).center(
        Point.fromLngLat(
          4.895033, 52.374724
        )
      ).build()
    )
    mapSnapshotter.setStyleJson(
      """
        {
          "version": 8,
          "metadata": {
            "test": {
              "width": 64,
              "height": 64
            }
          },
          "sources": {},
          "layers": [
            {
              "id": "background",
              "type": "background",
              "paint": {
                "background-color": "red"
              }
            }
          ]
        }
      """.trimIndent()
    )
    // ignore error in this example
    mapSnapshotter.start { bitmap, _ ->
      val imageView = ImageView(this)
      imageView.setImageBitmap(bitmap)
      setContentView(imageView)
    }
  }

  override fun onDestroy() {
    super.onDestroy()
    mapSnapshotter.destroy()
  }

  companion object {
    const val TAG: String = "LocalStyleMapSnapshotterActivity"
  }
}
```