I have this layout
Two SearchView widgets
One ListView
When I press the android back key the focus cycles between the filter box and the search box.
I want to go back to my previous activity, but I cannot do it, since the back key only goes from one box to the other.
How can I get the back key press event ?
this code does not even get called
@Override
public void onBackPressed() {
setResult(Activity.RESULT_CANCELED);
super.onBackPressed();
}
The problem is definitely with the SearchView widgets and its handling of the focus/backkey.
I changed the SearchViews to EditTexts
I changed the QueryTextListeners to TextWatchers
and... voila!
Now the onBackPressed() is called and the activity can return to its previous caller.