MenuProvider
public interface MenuProvider
Interface for indicating that a component will be supplying MenuItems to the component owning the app bar.
Summary
Public methods |
|
|---|---|
abstract void |
onCreateMenu(@NonNull Menu menu, @NonNull MenuInflater menuInflater)Called by the |
default void |
onMenuClosed(@NonNull Menu menu) |
abstract boolean |
onMenuItemSelected(@NonNull MenuItem menuItem)Called by the |
default void |
onPrepareMenu(@NonNull Menu menu) |
Public methods
onCreateMenu
abstract void onCreateMenu(@NonNull Menu menu, @NonNull MenuInflater menuInflater)
Called by the MenuHost to allow the MenuProvider to inflate MenuItems into the menu.
| Parameters | |
|---|---|
@NonNull Menu menu |
the menu to inflate the new menu items into |
@NonNull MenuInflater menuInflater |
the inflater to be used to inflate the updated menu |
onMenuItemSelected
abstract boolean onMenuItemSelected(@NonNull MenuItem menuItem)
Called by the MenuHost when a MenuItem is selected from the menu.
| Returns | |
|---|---|
boolean |
|
onPrepareMenu
default void onPrepareMenu(@NonNull Menu menu)
Called by the MenuHost right before the Menu is shown. This should be called when the menu has been dynamically updated.
| See also | |
|---|---|
onCreateMenu |