Answer the question
In order to leave comments, you need to log in
Why is the onDetach method called when returning to the previous fragment in the fragment stack?
There are 2 fragments A and B.
Fragment B can be added to the fragment stack by the following method.
Fragment b = new B();
getSupportFragmentManager().beginTransaction().addToBackStack(null).replace(R.id.new_fragment_container, b).commit();
FragmentManager fm = getSupportFragmentManager();
if (fm.getBackStackEntryCount() > 0)
fm.popBackStack();
else
finish();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question