Search activity not being launched when pressing enter
After a long Research i have Analyse something
searchView.setSearchableInfo( searchManager.getSearchableInfo(new
ComponentName(this,SearchResultsActivity.class)));
Here the activity.class is the name of the searchable activity where you want to pass the search query.
I had the same problem, and my search for an answer took me here, so here is what worked for me...
Make sure your
searchables.xml
file is in the correct location (i.e, in yourres/xml/
folder) and that the same file does not contain any errors - otherwise you will find that(SearchManager)getSystemService(Context.SEARCH_SERVICE).getSearchableInfo(componentName)
will return null, breaking your search functionality.(Also, ensure you set
componentName
in the appropriate manner, because the example shown in the Android guide is for only when you are making searches and displaying searches in the same Activity.)
...am sharing in the hope it may save someone else a wasted 4 hours! :/