MenuItemKt

Added in 1.0.0

public final class MenuItemKt


Summary

Public methods

static final boolean

Attempt to navigate to the NavDestination associated with this MenuItem.

Public methods

public static final boolean onNavDestinationSelected(
    @NonNull MenuItem receiver,
    @NonNull <Error class: unknown class> navController
)

Attempt to navigate to the NavDestination associated with this MenuItem.

Importantly, it assumes the getItemId matches a valid androidx.navigation.NavDestination.getAction or androidx.navigation.NavDestination.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.