In my application, like many other, there is a common search widget (http://developer.android.com/guide/topics/search/search-dialog.html#UsingSearchWidget).
I would change fragment (and pass to it the term searched) only when the search button on the keyboard is pressed.
I've tried with
searchView.setOnSearchClickListener(new OnClickListener() {
@Override public void onClick(View v) {
} });
but it is triggered when you press the button ON THE ACTION BAR, that uncollapse the search input, and not when the keybord button search is clicked.
Do you know how is possible?
You can use this tо detect search key press in action bar search:
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String s) {
[You actions here]
return false;
}
}
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