What is: Activity , the whole part of the space of which is occupied by two Fragment (alternately). The first Fragment contains a SearchView search widget and a list based on RecyclerView . By clicking on the list item, the first Fragment is changed to the second. The second Fragment will contain only a list (other) based on RecyclerView .
What you need to do: By clicking on the Back Button (back), you need the Activity to first roll back the stack in the FragmentManager by calling popBackStack() , then when only the initial (first) Fragment remains, you need to close the Activity
Problem: Obviously, because of the focus on SearchView , the Back Button does not work, respectively, OnBackPressed() with the entire OnBackPressed() on rollback of the stack is not called in the Activity . Google’s long hours suggested that the SearchView is only a Toolbar’s kosher place, but this is not a valid solution for several reasons:
- I want to have a widget in Fragment 'e;
- Of all, only the logic on the "back" key does not work;
- There are plans to transfer both Fragment 'a to BottomSheet to a completely different Activity , in which the search widget in the Toolbar will be out of place.
I need help with solving a problem, or another search widget, if suddenly I missed it.