title: Filtering ListView by SearchView's query - what am I doing wrong?
body: <p>As the topic's name mentions, I'm facing a problem when I'm trying to implement live ListView filtering, when user enters some text in search bar, which is located in the Action Bar. 
  P.S. I didn't even hav Log.i("Nomad", "onQueryTextChange") in onQueryTextChange() printed in the log, when I'm debugging the application :/</p>
  
  <p>AllLists.java</p>
  
  <pre><code>public class AllLists extends Fragment implements SearchView.OnQueryTextListener{
  
  private TypedArray navMenuIcons;
  private Context context;
  private int position = 0;
  private String location;
  private List&lt;Item&gt; items = new ArrayList&lt;Item&gt;();
  private ListView listView;
  private CustomListAdapter adapter;
  private SearchView mSearchView;
  
  public AllLists(Context context) {
      this.context = context;
  }
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
      View rootView = inflater.inflate(R.layout.alllists, container, false);
      View header = inflater.inflate(R.layout.list_header, null);
    //  View list_view = inflater.inflate(R.layout.list_item, null);
      ImageView image = (ImageView) header.findViewById(R.id.small_icon);
      header.setClickable(false);
     // ImageView logo = (ImageView) list_view.findViewById(R.id.image);
      navMenuIcons = getResources().obtainTypedArray(R.array.nav_drawer_icons);
      Bundle bundle = getArguments();
      position = bundle.getInt("position");
      location = bundle.getString("location");
      image.setImageDrawable(navMenuIcons.getDrawable(position));
      DatabaseHandler db = new DatabaseHandler(context);
      items = db.getAllItems(location);
      listView = (ListView) rootView.findViewById(R.id.list);
      adapter = new CustomListAdapter(context, items);
      listView.setAdapter(adapter);
      listView.addHeaderView(header);
      listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
              if (location.equals("accommodation") || location.equals("eat") || location.equals("events")
                      || location.equals("entertainment") || location.equals("places") || location.equals("cinema")) {
                  Intent i = new Intent(context, ItemScreen.class);
                  i.putExtra("position", position - 1);
                  i.putExtra("location", location);
                  startActivity(i);
              }
          }
      });
      setHasOptionsMenu(true);
      return rootView;
  }
  
  /*SearchView.OnQueryTextListener(new SearchView.OnQueryTextListener){
  
  }*/
  
  @Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
      super.onCreateOptionsMenu(menu, inflater);
      inflater.inflate(R.menu.main, menu);
      MenuItem searchItem = menu.findItem(R.id.action_search);
      mSearchView = (SearchView) MenuItemCompat.getActionView(searchItem);
      mSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
          @Override
          public boolean onQueryTextSubmit(String s) {
              return false;
          }
  
          @Override
          public boolean onQueryTextChange(String s) {
              adapter.getFilter().filter(s);
              return false;
          }
      });
  }
  
  @Override
  public boolean onQueryTextChange(String s) {
      Log.i("Nomad", "onQueryTextChange");
      adapter.getFilter().filter(s);
      return false;
  }
  
  @Override
  public boolean onQueryTextSubmit(String s) {
      return false;
  }
  }
  </code></pre>
  
  <p>CustomListAdapter.java</p>
  
  <pre><code>public class CustomListAdapter extends BaseAdapter {
  
  private Context context;
  private List&lt;Item&gt; items;
  private LayoutInflater inflater;
  ImageLoader imageLoader = AppController.getInstance().getImageLoader();
  private List&lt;Item&gt; filteredData;
  
  
  public CustomListAdapter(Context context, List&lt;Item&gt; items) {
      this.context = context;
      this.items = items;
  }
  
  @Override
  public int getCount() {
      return items.size();
  }
  
  @Override
  public Object getItem(int position) {
      return items.get(position);
  }
  
  @Override
  public long getItemId(int position) {
      return position;
  }
  
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
      if (inflater == null)
          inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      if (convertView == null)
          convertView = inflater.inflate(R.layout.list_item, null);
      if (imageLoader == null)
          imageLoader = AppController.getInstance().getImageLoader();
      NetworkImageView image = (NetworkImageView) convertView.findViewById(R.id.image);
      TextView name = (TextView) convertView.findViewById(R.id.name);
      TextView type = (TextView) convertView.findViewById(R.id.type);
      Item i = items.get(position);
      // Log.d("FOTO linkas: " + i.getName() + " ", i.getIcon());
      if (i.getIcon().contains("http")) {
          //   Log.d("suveike: ", i.getIcon());
          image.setImageUrl(i.getIcon(), imageLoader);
      }/*else if(items.get(0).getName().contains("taksi")) {
          Log.d("suveike: ", "else if");
          image.setImageResource(R.drawable.logo);
      }*/ else
          image.setImageResource(R.drawable.logo);
      name.setText(i.getName());
      type.setText(i.getType());
      return convertView;
  }
  
  public Filter getFilter() {
      return new Filter() {
          @Override
          protected FilterResults performFiltering(CharSequence charSequence) {
              FilterResults results = new FilterResults();
              if (charSequence == null || charSequence.length() == 0) {
                  results.values = items;
                  results.count = items.size();
              } else {
                  List&lt;Item&gt; filtered_items = new ArrayList&lt;Item&gt;();
  
                  for (int i = 0; i &lt; items.size(); i++) {
                      if (items.get(i).getName().contains(charSequence))
                          filtered_items.add(items.get(i));
                  }
  
                  results.values = filtered_items;
                  results.count = filtered_items.size();
              }
  
              return results;
          }
  
          @Override
          protected void publishResults(CharSequence charSequence, FilterResults filterResults) {
              filteredData = (List&lt;Item&gt;) filterResults.values;
              notifyDataSetChanged();
          }
      };
  }
  }
  </code></pre>