Asked
Active
Viewed 375 times
0
-
I am new to the android .. hanging up with this one for many days.. – Devaraj Mar 31 '16 at 08:12
-
1Please review your question and read the [how-to-ask](http://stackoverflow.com/help/how-to-ask) article. – zyexal Mar 31 '16 at 08:13
2 Answers
0
Activity file: For the more detail please read this answer .
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater menuInflater = getMenuInflater();
menuInflater.inflate(R.menu.dashboard, menu);
MenuItem searchItem = menu.findItem(R.id.action_search);
SearchManager searchManager = (SearchManager) MainActivity.this.getSystemService(Context.SEARCH_SERVICE);
SearchView searchView = null;
if (searchItem != null) {
searchView = (SearchView) searchItem.getActionView();
}
if (searchView != null) {
searchView.setSearchableInfo(searchManager.getSearchableInfo(MainActivity.this.getComponentName()));
}
return super.onCreateOptionsMenu(menu);
}

Community
- 1
- 1

Muhammad Waleed
- 2,517
- 4
- 27
- 75
0
Set searchView.setIconified(false);
This will show EditText on opening the screen with searchView.
You can see here for the details: Show android SearchView EditText by default

Community
- 1
- 1

Android Geek
- 8,956
- 2
- 21
- 35