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

# Multi map fragments

![Using multiple map fragments in one Activity.](https://docs.mapbox.com/android/assets/ideal-img/maps-examples-multi-map-fragments.e95de96.480.png)

This example demonstrates how to use multiple map views within a single activity using fragments and the **Mapbox Maps SDK for Android**.

The code includes logic to create and set up four different map views with distinct styles and locations. Each map fragment is initialized with a specific style using the `initFragmentStyle` method, which loads the specified `Style` and sets the camera position using the [`CameraOptions`](https://docs.mapbox.com/android/maps/api/latest/mapbox-maps-android/com.mapbox.maps/-camera-options/) generated by the `generateCamera` method.

> **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.29.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: `MultiMapActivity.kt`

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

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

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.mapbox.geojson.Point
import com.mapbox.maps.CameraOptions
import com.mapbox.maps.Style
import com.mapbox.maps.testapp.R
import com.mapbox.maps.testapp.examples.fragment.MapFragment

/**
 * Example showing using several map views in one activity.
 */
class MultiMapActivity : AppCompatActivity() {

  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_multi_map)
    initFragmentStyle(R.id.map1, Style.STANDARD, generateCamera(38.913187, -77.032546, 12.0))
    initFragmentStyle(R.id.map2, Style.LIGHT, generateCamera(37.775732, -122.413985, 13.0))
    initFragmentStyle(R.id.map3, Style.STANDARD_SATELLITE, generateCamera(12.97913, 77.59188, 14.0))
    initFragmentStyle(R.id.map4, Style.DARK, generateCamera(-13.155980, -74.217134, 15.0))
  }

  private fun initFragmentStyle(
    fragmentId: Int,
    styleId: String,
    cameraOptions: CameraOptions
  ) {
    val fragment = supportFragmentManager.findFragmentById(fragmentId) as MapFragment
    fragment.getMapAsync {
      it.setCamera(cameraOptions)
      it.loadStyle(styleId)
    }
  }

  private fun generateCamera(lat: Double, lng: Double, zoom: Double): CameraOptions {
    return CameraOptions.Builder().center(Point.fromLngLat(lng, lat)).zoom(zoom).build()
  }
}
```