I have a requirement where I have to show some location with the map view beside them. So I am planning to Put the Map view inside the row of Recycler view

Doing so will cost some performance issue. As map takes lots of memory. So I am reluctant to do so.

What are other options that I am left with? How can I Achieve that? Please help me in this..... Thanks

1 Answers

4
Andrii Omelchenko On Best Solutions

Use Lite Mode of Google Maps for do what you need:

Lite mode uses the same classes and interfaces as the full Google Maps Android API. You can set a GoogleMap to lite mode in the following ways:

  • Either as an XML attribute for a MapView or MapFragment
  • Or in the GoogleMapOptions object

As an XML attribute for a MapView or MapFragment

<fragment xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:map="http://schemas.android.com/apk/res-auto"
    android:name="com.google.android.gms.maps.MapFragment"
    android:id="@+id/map"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    map:cameraZoom="13"
    map:mapType="normal"
    map:liteMode="true"/>

In the GoogleMapOptions object

GoogleMapOptions options = new GoogleMapOptions().liteMode(true);

Here is an official example for displaying maps efficiently in RecyclerView using lite mode.