1. Are you ready for the Galaxy S20? Here is everything we know so far!

About the addToBackStack() method

Discussion in 'Android Development' started by ac4android, Feb 4, 2016.

  1. ac4android

    ac4android Well-Known Member
    Thread Starter

    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 (Text):
    1.  
    2. FragmentTransaction ftx = getFragmentManager().beginTransaction();
    3. ftx.replace(R.id.my_container_frame, fragment);
    4. ftx.addToBackStack(null);
    5.  
    QUESTION: But doesn't the null in addToBackStack(null) mean it won't be added to the backstack?
     



    1. Download the Forums for Android™ app!


      Download

       
  2. Deleted User

    Deleted User Guest

  3. ac4android

    ac4android Well-Known Member
    Thread Starter

    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?
     
  4. Deleted User

    Deleted User Guest

Loading...
Similar Threads - addToBackStack method
  1. Troubleshooter03
    Replies:
    2
    Views:
    423
  2. Teofel Ervenge
    Replies:
    8
    Views:
    941
  3. Rgarner
    Replies:
    2
    Views:
    775
  4. Gobshyte
    Replies:
    0
    Views:
    352
  5. genka3
    Replies:
    13
    Views:
    3,993
  6. neha goenka
    Replies:
    0
    Views:
    2,143
  7. kumaranil13k
    Replies:
    5
    Views:
    1,966
  8. Mtn Drew
    Replies:
    5
    Views:
    2,372
  9. kamieniarzk
    Replies:
    0
    Views:
    1,577
  10. katesfb
    Replies:
    0
    Views:
    2,026

Share This Page

Loading...