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

The FragmentManager

The FragmentManager is a component that takes care of the fragments belonging to an activity. This includes fragments on the back stack and fragments that may just be hanging around. We’ll explain.

Fragments should only be created within the context of an activity. This occurs either through the inflation of an activity’s layout XML or through direct instantiation using code like that in Listing 8–1. When instantiated through code, a fragment usually gets attached to the activity using a fragment transaction. In either case, the FragmentManager class is used to access and manage these fragments for an activity.

You use the getFragmentManager() method on either an activity or an attached fragment to retrieve a fragment manager. ...

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