List of usage examples for android.widget SearchView onActionViewCollapsed
@Override public void onActionViewCollapsed()
From source file:org.que.activities.MainNavigationActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { if (menu != null) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main, menu); final SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView(); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { public boolean onQueryTextSubmit(String query) { Toast.makeText(MainNavigationActivity.this, "Submitted: " + query, Toast.LENGTH_LONG).show(); searchView.onActionViewCollapsed(); //close search view startSearch(query);/* w w w . j ava2 s.co m*/ return true; } public boolean onQueryTextChange(String arg0) { return true; } }); } return super.onCreateOptionsMenu(menu); }