• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps About the addToBackStack() method

ac4android

Well-Known Member
In very simple terms, lets say I have several fragments and on the UI, the user can click on any item which then selects one of the fragments. The user must be able to use the "back" key to get back to previous screen.

I tend to end up with these few lines of codes:
Code:
FragmentTransaction ftx = getFragmentManager().beginTransaction();
ftx.replace(R.id.my_container_frame, fragment);
ftx.addToBackStack(null);

QUESTION: But doesn't the null in addToBackStack(null) mean it won't be added to the backstack?
 
Read the answers in the link, the null still seems spurious.
Under what circumstances would I want a none-null label or tag ?
Do you have some practical examples?
 
Back
Top Bottom