added in version 22.1.0
belongs to Maven artifact


public class FragmentActivity
extends Activity implements LifecycleOwner, ViewModelStoreOwner, ActivityCompat.OnRequestPermissionsResultCallback

   ↳ android.content.Context
     ↳ android.content.ContextWrapper
       ↳ android.view.ContextThemeWrapper
Known Direct Subclasses

Base class for activities that want to use the support-based Fragment and Loader APIs.

When using this class as opposed to new platform's built-in fragment and loader support, you must use the getSupportFragmentManager() and getSupportLoaderManager() methods respectively to access those features.

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>.


Inherited constants

From class
From class android.content.Context
From interface android.content.ComponentCallbacks2

Inherited fields

From class

Public constructors


Public methods

void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args)

Print the Activity's state into the given stream.

Object getLastCustomNonConfigurationInstance()

Return the value previously returned from onRetainCustomNonConfigurationInstance().

Lifecycle getLifecycle()

Returns the Lifecycle of the provider.

FragmentManager getSupportFragmentManager()

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

LoaderManager getSupportLoaderManager()
ViewModelStore getViewModelStore()

Returns the ViewModelStore associated with this activity

void onAttachFragment(Fragment fragment)

Called when a fragment is attached to the activity.

void onBackPressed()

Take care of popping the fragment back stack or finishing the activity as appropriate.

void onConfigurationChanged(Configuration newConfig)

Dispatch configuration change to all fragments.

boolean onCreatePanelMenu(int featureId, Menu menu)

Dispatch to Fragment.onCreateOptionsMenu().

View onCreateView(View parent, String name, Context context, AttributeSet attrs)
View onCreateView(String name, Context context, AttributeSet attrs)
void onLowMemory()

Dispatch onLowMemory() to all fragments.

boolean onMenuItemSelected(int featureId, MenuItem item)

Dispatch context and options menu to fragments.