MenuItemKt

public final class MenuItemKt


Summary

Public methods

static final boolean
MenuItemKt.onNavDestinationSelected(
    @NonNull MenuItem receiver,
    @NonNull NavController navController
)

Attempt to navigate to the NavDestination associated with this MenuItem.

Public methods

MenuItemKt.onNavDestinationSelected

@NonNull
public static final boolean MenuItemKt.onNavDestinationSelected(
    @NonNull MenuItem receiver,
    @NonNull NavController navController
)

Attempt to navigate to the NavDestination associated with this MenuItem.

Importantly, it assumes the getItemId matches a valid action id or destination id to be navigated to.

By default, the back stack will be popped back to the navigation graph's start destination. Menu items that have android:menuCategory="secondary" will not pop the back stack.

Returns
boolean

True if the NavController was able to navigate to the destination.