public class ComponentActivity implements ContextAware, LifecycleOwner, ViewModelStoreOwner, HasDefaultViewModelProviderFactory, LifecycleOwner, SavedStateRegistryOwner, LifecycleOwner, OnBackPressedDispatcherOwner, ActivityResultRegistryOwner, ActivityResultCaller, OnConfigurationChangedProvider, OnTrimMemoryProvider, OnNewIntentProvider, MenuHost

Known direct subclasses

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

Known indirect 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 enables composition of higher level components.

Rather than all functionality being built directly into this class, only the minimal set of lower level building blocks are included. Higher level components can then be used as needed without enforcing a deep Activity class hierarchy or strong coupling between components.


Public constructors

Default constructor for ComponentActivity.

ComponentActivity(@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
@Override void

Adds the given MenuProvider to this MenuHost.

@Override void
    @NonNull MenuProvider provider,
    @NonNull LifecycleOwner owner

Adds the given MenuProvider to this MenuHost.