public class FragmentActivity extends ComponentActivity implements ContextAware, LifecycleOwner, ViewModelStoreOwner, HasDefaultViewModelProviderFactory, LifecycleOwner, SavedStateRegistryOwner, LifecycleOwner, OnBackPressedDispatcherOwner, ActivityResultRegistryOwner, ActivityResultCaller, MenuHost, ActivityCompat.OnRequestPermissionsResultCallback

   ↳ ComponentActivity
     ↳ FragmentActivity
Known direct subclasses

Base class for activities that wish to use some of the newer platform features on older Android devices.


The class representing a car app activity.

Base class for activities that want to use the support-based Fragments.

Known limitations:

  • When using the <fragment> tag, this implementation can not use the parent view's ID as the new fragment's ID. You must explicitly specify an ID (or tag) in the <fragment>.


Public constructors

Default constructor for FragmentActivity.

FragmentActivity(@LayoutRes int contentLayoutId)

Alternate constructor that can be used to provide a default layout that will be inflated as part of super.onCreate(savedInstanceState).

Public methods

@Override void
    @NonNull String prefix,
    @Nullable FileDescriptor fd,
    @NonNull PrintWriter writer,
    String[] args

Print the Activity's state into the given stream.

@NonNull FragmentManager

Return the FragmentManager for interacting with fragments associated with this activity.

@NonNull LoaderManager

This method is deprecated.

Use LoaderManager.getInstance(this).

@MainThread void

This method is deprecated.

The responsibility for listening for fragments being attached has been moved to FragmentManager.