how to go back to previous fragment on pressing manually back button of individual fragment?
- 阅读更多 关于 how to go back to previous fragment on pressing manually back button of individual fragment?
问题 I have only one activity and multiple fragments in my application. Two main fragment A(left) and B(right). Fragment A1 called from A B1 called from B B2 called from B1 All fragments have individual back buttons. So when I press back button of fragment A1 , it should go back to A , similarly when Back button from B2 is pressed, B1 appears and from B1 to B and so on. How to implement this type of functionality? 回答1: public void onBackPressed() { FragmentManager fm = getActivity()