MenuHost

interface MenuHost

Known direct subclasses
ComponentActivity

Base class for activities that enables composition of higher level components.

Toolbar

A standard toolbar for use within application content.

Known indirect subclasses
AppCompatActivity

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

CarAppActivity

The class representing a car app activity.

FragmentActivity

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


A class that allows you to host and keep track of MenuProviders that will supply android.view.MenuItems to the app bar.

See also
MenuHostHelper

Summary

Public methods

abstract void

Adds the given MenuProvider to this MenuHost.

abstract void
addMenuProvider(
    @NonNull MenuProvider provider,
    @NonNull LifecycleOwner owner
)

Adds the given MenuProvider to this MenuHost.

abstract void
addMenuProvider(
    @NonNull MenuProvider provider,
    @NonNull LifecycleOwner owner,
    @NonNull Lifecycle.State state
)

Adds the given MenuProvider to this MenuHost once the given LifecycleOwner reaches the given Lifecycle.State.

abstract void

Invalidates the android.view.Menu to ensure that what is displayed matches the current internal state of the menu.

abstract void

Removes the given MenuProvider from this MenuHost.

Public methods

addMenuProvider

abstract void addMenuProvider(@NonNull MenuProvider provider)

Adds the given MenuProvider to this MenuHost. If using this method, you must manually remove the provider when necessary.

Parameters
@