The `getAvailableMaps` API fetches information for all maps that are available to be displayed.

This is useful if you would like to give your users a variety of map styles to choose from.

<BlockSwitcher>
<Block name="Java">

```java
Amplify.Geo.getAvailableMaps(
    result -> {
        for (final MapStyle style : result) {
            Log.i("MyAmplifyApp", style.toString());
        }
    },
    error -> Log.e("MyAmplifyApp", "Failed to get available maps.", error)
);
```

</Block>
<Block name="Kotlin - Callbacks">

```kotlin
Amplify.Geo.getAvailableMaps(
    {
        for (mapStyle in it) {
            Log.i("MyAmplifyApp", mapStyle.toString())
        }
    },
    { Log.e("MyAmplifyApp", "Failed to get available maps.", it) }
)
```

</Block>
<Block name="Kotlin - Coroutines">

```kotlin
try {
    val result = Amplify.Geo.getAvailableMaps()
    for (mapStyle in result) {
        Log.i("MyAmplifyApp", mapStyle.toString())
    }
} catch (error: GeoException) {
    Log.e("MyAmplifyApp", "Failed to get available maps.", error)
}
```

</Block>
<Block name="RxJava">

```java
RxAmplify.Geo.getAvailableMaps().subscribe(
    result -> {
        for (final MapStyle style : result) {
            Log.i("MyAmplifyApp", style.toString());
        }
    },
    error -> Log.e("MyAmplifyApp", "Failed to get available maps.", error)
);
```

</Block>
</BlockSwitcher>

You can set a different style to your map using `setStyle` method from the adapter:

<BlockSwitcher>
<Block name="Java">

With `MapLibreView`:

```java
// where mapStyle is a reference to the selected style from Amplify.Geo.getAvailableMaps
mapView.setStyle(mapStyle, style -> {
    Log.i("MyAmplifyApp", "Finished loading " + mapStyle.getStyle());
});
```

With `AmplifyMapView`:
```java
// where mapStyle is a reference to the selected style from Amplify.Geo.getAvailableMaps
amplifyMapView.getMapView().setStyle(mapStyle, style -> {
    Log.i("MyAmplifyApp", "Finished loading " + mapStyle.getStyle());
});
```


</Block>
<Block name="Kotlin">

With `MapLibreView`:

```kotlin
// where mapStyle is a reference to the selected style from Amplify.Geo.getAvailableMaps
mapView.setStyle(mapStyle) { style ->
    Log.i("MyAmplifyApp", "Finished loading ${mapStyle.style}.")
}
```

With `AmplifyMapView`:

```kotlin
// where mapStyle is a reference to the selected style from Amplify.Geo.getAvailableMaps
amplifyMapView.mapView.setStyle(mapStyle) { style ->
    Log.i("MyAmplifyApp", "Finished loading ${mapStyle.style}.")
}
```

</Block>
</BlockSwitcher>
