@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.music_picker, menu); SearchView search = (SearchView) MenuItemCompat.getActionView(menu .findItem(R.id.action_search)); search.setOnQueryTextListener(new OnQueryTextListener() { @Override public boolean onQueryTextChange(String newText) { mAdapter.getFilter().filter(newText); return true; } @Override public boolean onQueryTextSubmit(String query) { // TODO Auto-generated method stub return true; } }); search.setOnCloseListener(new OnCloseListener() { @Override public boolean onClose() { mAdapter.getFilter().filter(""); return false; } }); return true; }