Android Adding Search Functionality to List

Android Adding Search Functionality to List

Today we are going to learn how to add search functionality to ListView, GridView and RecyclerView. In this tutorial you can filter search list by multiple items.


  1. Material Tabs Tutorial
  2. ListView Tutorial
  3. GridView Tutorial
  4. RecyclerView Tutorial
  5. Radio Button Tutorial


1. Create a new project in Android Studio by navigating to File ⇒ New ⇒ New Project and fill required details. By default my activity is

2. Open build.gradle and include this libraries show below:

3. Now create 3 material tabs naming ListView, GridView and RecyclerView. For this you can check this link for reference.

4. After creating tabs lets move to creating xml layouts for individual tabs.

  • list_view_frament.xml
  • grid_view_fragment.xml
  • recycler_view_fragment.xml
5. In all the above xml layouts i am using one common layout i.e. top_container.xml. Lets create the common layout xml, this layout contains some radio buttons for custom filter.
6. Now create custom background for Search EditText naming search_bg.xml.
7. Now lets create java classes for all the above three xml files.

In all the above fragment classes the common code to do filtering is:
Here we need to call the filter method created in adapter class by passing the filter query.

8. Now after creating all fragment classes we have to create Adapters for ListView, GridView and RecyclerView.

In both the above adapter the common code to filter is:
9. Some helper java classes that we need in this article are:

10. Finally all things done. Now you can also make filterable ListView.

Thanks. 🙂

Download Source Code


About the author

I am an Android developer for whom Android is the one and only love. I work as a freelancer which gets me and Android closer. I always love to share my learnings and love to learn from others knowledge too.

Leave a Comment

Comment (required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

Name (required)
Email (required)