O'Reilly logo

Pro Android 4 by Satya Komatineni, Dave MacLean

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

FragmentTransactions and the Fragment Back Stack

The code in showDetails() that pulls in your new details fragment (shown again in Listing 8–8) looks rather simple, but there’s a lot going on here. It’s worth spending some time to explain what is happening and why. If your activity is in multipane mode, you want to show the details in a fragment next to the title list. You may already be showing details, which means you may have a details fragment visible to the user. Either way, the resource ID R.id.details is for the FrameLayout for your activity, as shown in Listing 8–3. If you have a details fragment sitting in the layout because you didn’t assign any other ID to it, it will have this ID. Therefore, to find out if there’s a details fragment ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required