Back button closing app even when using FragmentTransaction.addToBackStack()
问题 None of the other questions I have read on stackoverflow have been able to help with my problem. As far as I can tell, I am doing everything correctly. I have a master/detail flow with fragments. Upon creation of the main activity, the master fragment is loaded with the following code: Fragment frag; frag = new MainListFragment();//<-- **the master fragment** FragmentManager fm = getFragmentManager(); FragmentTransaction transaction = fm.beginTransaction(); transaction.replace(R.id.fragment