I have a searchView
in my SearchActivity
and it creates an intent to launch a SearchActivityResults
according to the documentation here: http://developer.android.com/training/search/setup.html
How do I need to go if I want my SearchView
to trigger a search from within my activity, when the soft keyboard lower right button is pressed to trigger the search?
you just need to get your searchView menu , use override onCreateOptionsMenu
SearchView searchView = (SearchView) MenuItemCompat
.getActionView(mSearchMenuItem);
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String s) {
return false;
}
@Override
public boolean onQueryTextChange(String s) {
// do your search on change or save the last string in search
return false;
}
});
// you can get query
searchView.getQuery();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With