Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

NavController.NavHostOnBackPressedManager

public final class NavController.NavHostOnBackPressedManager
extends Object

java.lang.Object
   ↳ androidx.navigation.NavController.NavHostOnBackPressedManager


Class returned by NavController.setHostOnBackPressedDispatcherOwner(OnBackPressedDispatcherOwner) to allow the NavHost to manually disable or enable whether the NavController should actively handle system Back button events.

Summary

Public methods

void enableOnBackPressed(boolean enabled)

Set whether the NavController should handle the system Back button events via the registered OnBackPressedDispatcher.

Inherited methods

Public methods

enableOnBackPressed

public void enableOnBackPressed (boolean enabled)

Set whether the NavController should handle the system Back button events via the registered OnBackPressedDispatcher.

Parameters
enabled boolean: True if the NavController should handle system Back button events.