setToolbarItemsProvider

Customizes the main-toolbar items declaratively — the replacement for the removed onCreateOptionsMenu/onPrepareOptionsMenu/OnMenuItemsGenerateListener path. The provider receives the SDK's default items and returns the items to show (add custom items, drop or reorder defaults, or change per-item state). Call invalidateToolbarItems to re-run it when your own state changes.

Parameters

provider

the provider to set, or null to clear it.