I\'m using a single activity to display SearchView as well as to display search results. The search results is just a subset of items so the search acts as a filter. Everythin
All code here is deprecated ! You should use something like this.
final MenuItem item = menu.findItem(R.id.action_search);
final SearchView searchView = (SearchView) item.getActionView();
item.setOnActionExpandListener(new MenuItem.OnActionExpandListener() {
@Override
public boolean onMenuItemActionExpand(MenuItem item) {
Toast.makeText(getActivity(), "onMenuItemActionExpand called", Toast.LENGTH_SHORT).show();
return true;
}
@Override
public boolean onMenuItemActionCollapse(MenuItem item) {
Toast.makeText(getActivity(), "onMenutItemActionCollapse called", Toast.LENGTH_SHORT).show();
return true;
}
});
Hope that will help.