I have a map fragment which I populate it with some markers that I download from an API, I have added a SearchView
in top of my fragment and now I want to search through markers by title or snipped. and while typing showing a list of items matching the query. then by tapping an item remove all other markers and zoom on the tapped marker.
how can I do that?
fragment_map.xml
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.abed.whitelabel.Fragments.CustomersFragment">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.SearchView
android:id="@+id/map_search_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
></android.support.v7.widget.SearchView>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</FrameLayout>