Hello good people,We cover how to perform a Custom Filter against data in your ListView.Our adapter is BaseAdapter and we shall be searching ListView with images and text.We shall implement Filterable interface and derive from Filter class.

PLATFORM : Android Java
TOOLS : Eclipse,Bluestacks Emulator

SECTION 1 : Our Player Class.

Purpose :

  1. Is our POJO class.Plain Old Java Object
  2. Holds data consisting of a single Player.
package com.tutorials.listviewcustomfilterbase;

public class Player {

  private String name;
  private int img;

  public Player(String name,int img) {
    // TODO Auto-generated constructor stub


  public String getName() {
    return name;

  public void setName(String name) {
    this.name = name;

  public int getImg() {
    return img;

  public void setImg(int img) {
    this.img = img;

SECTION 2 : Our Custom Adapter class

  1. Adapts our images and Text to our ListView
  2. Is where we bind data to views
  3. Has an inner class CustomFilter that implements Filtering or Searching for us.
  4. Implements Filterable method hence we override getFilter() method that in turn returns a filter object.

SECTION 3: Our MainActivity class:

Purpose :

  1. Our launcher activity
  2. We set reference our ListView from XML and attach its BaseAdapter subclass to it.
  3. We reference our SearchView and implement its onQueryTextChangeListener.

SECTION 4 : Our ActivityMain.xml layout

Purpose :

  1. Acts as our template Layout.
  2. Hold our ListView and SearchView

SECTION 4: Our Model.xml Layout Purpose :

  1. Acts as our Row Model.Remember we want to display Listview with images and text.So its how a single row in our ListView shall appear.
  2. Contains Images andText.

Good day.