I am trying to create an action bar with search. I am able to create the search bar. How I can get the text entered in the field to string? Is there any good code for action bar with search?
What I done is
SearchManager searchManager =
(SearchManager) getSystemService(Context.SEARCH_SERVICE);
SearchView searchView =
(SearchView) menu.findItem(R.id.menu_search).getActionView();
Intent intent = getIntent();
if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
String search = intent.getStringExtra(SearchManager.QUERY);
You can use the search bar as like this.