title: Actionbarsherlock searchview: setOnQueryTextListener
body: <p>I'm trying to make a filter in a List using ActionBarSherlock's search view. The code I currently have is the following:</p>
  
  <pre><code>@Override
  public boolean onCreateOptionsMenu(final Menu menu) {
      getSupportMenuInflater().inflate(R.menu.building_search, menu);
  
      SearchView searchView = new SearchView(getSupportActionBar().getThemedContext());
  
      SearchView.OnQueryTextListener queryTextListener = new SearchView.OnQueryTextListener() 
      {
          public boolean onQueryTextChange(String newText) 
          {
              // this is your adapter that will be filtered
              listAdapter.getFilter().filter(newText);
              return true;
          }
  
          public boolean onQueryTextSubmit(String query) 
          {
              // this is your adapter that will be filtered
              listAdapter.getFilter().filter(query);
              return true;
          }
      };
      searchView.setOnQueryTextListener(queryTextListener);
  
      return true;
  }
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
      switch (item.getItemId()) {
          case R.id.search:
              onSearchRequested();
              return true;
      }
      return super.onOptionsItemSelected(item);
  }
  </code></pre>
  
  <p>These are my imports:</p>
  
  <pre><code>import android.os.Bundle;
  import android.widget.AbsListView;
  import android.widget.ArrayAdapter;
  import be.ugent.zeus.hydra.AbstractSherlockActivity;
  import be.ugent.zeus.hydra.R;
  import be.ugent.zeus.hydra.data.caches.AssociationsCache;
  import com.actionbarsherlock.view.Menu;
  import com.actionbarsherlock.view.MenuItem;
  import com.actionbarsherlock.widget.SearchView;
  import com.dd.plist.NSArray;
  import com.dd.plist.NSDictionary;
  import com.dd.plist.NSString;
  import com.dd.plist.XMLPropertyListParser;
  import com.emilsjolander.components.stickylistheaders.StickyListHeadersListView;
  import java.util.ArrayList;
  import java.util.HashMap;
  import java.util.HashSet;
  import java.util.logging.Level;
  import java.util.logging.Logger;
  </code></pre>
  
  <p>Most of it works: in my actionbar, I get a search icon, which is clickable and expands the searchview. What, however, doesn't work is the actual listener. I've put breakpoints inside both methods, but when I debug, nothing happens. The program doesn't break and nothing gets filtered and I can't figure out why.</p>
  
  <p>Does anyone has any idea?</p>
  
  <p>Thanks in advance.</p>