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

# MapView Snapshot

![Create a bitmap snapshot from a MapView.](https://docs.mapbox.com/android/ja/assets/ideal-img/maps-examples-mapview-snapshot.cdb4d2f.480.png)

This example demonstrates how to capture a snapshot or screenshot of a map using the [`snapShot`](https://docs.mapbox.com/android/maps/api/latest/mapbox-maps-android/com.mapbox.maps/-map-controllable/snapshot.html) method of the **Mapbox Maps SDK for Android**.

Clicking the floating action button (`fab`) triggers the `snapshot` method of the map view to take a snapshot of the map. The resulting bitmap image is then set as the image source of the `ImageView` using a `post` method, allowing the captured map snapshot to be displayed in the user interface.

> **Note**
> 
> This example uses the [`snapShot`](https://docs.mapbox.com/android/maps/api/latest/mapbox-maps-android/com.mapbox.maps/-map-controllable/snapshot.html) method. This functionality can also be accomplished using the [`snapShotter`](https://docs.mapbox.com/android/maps/api/latest/mapbox-maps-android/com.mapbox.maps/-snapshotter/) class which provides more robust options for creating and handling snapshots. See the [DDS Snapshotter](https://docs.mapbox.com/android/ja/maps/examples/android-view/dds-mapsnapshotter/) and [Local Style MapSnapshotter](https://docs.mapbox.com/android/ja/maps/examples/android-view/local-style-mapsnapshotter) examples for more information on using `SnapShotter`.

> **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: `MapViewSnapshotActivity.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/MapViewSnapshotActivity.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.maps.MapboxMap
import com.mapbox.maps.Snapshotter
import com.mapbox.maps.Style
import com.mapbox.maps.testapp.databinding.ActivityViewSnapshotBinding

/**
 * Example demonstrating taking simple snapshot or screenshot not using [Snapshotter] appearing
 * in bottom-left corner as [ImageView].
 */
class MapViewSnapshotActivity : AppCompatActivity() {

  private lateinit var mapboxMap: MapboxMap

  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    val binding = ActivityViewSnapshotBinding.inflate(layoutInflater)
    setContentView(binding.root)

    mapboxMap = binding.mapView.mapboxMap
    mapboxMap.loadStyle(Style.STANDARD)

    binding.fab.setOnClickListener {
      binding.mapView.snapshot { bitmap ->
        binding.imageView.post {
          binding.imageView.setImageBitmap(bitmap)
        }
      }
    }
  }
}
```

Title: `activity_view_snapshot.xml`

[View on GitHub](https://github.com/mapbox/mapbox-maps-android/blob/main/app/src/main/res/layout/activity_view_snapshot.xml)

```xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/coordinator_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <com.mapbox.maps.MapView
        android:id="@id/mapView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

    <com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="end|bottom"
        android:layout_margin="@dimen/fab_margin"
        android:src="@drawable/ic_layers"
        android:tint="@color/primary"
        app:backgroundTint="@android:color/white"/>

    <ImageView
        android:id="@+id/imageView"
        android:layout_width="128dp"
        android:layout_height="128dp"
        android:contentDescription="@string/content_description_snaphot"
        android:layout_gravity="start|bottom"/>

</androidx.coordinatorlayout.widget.CoordinatorLayout>
```