Skip to content
On this page

Predictive Back ​

Predictive Back is a navigation pattern tied to gesture navigation which shows the user a glimpse of where swiping back will bring them. Before completing a swipe, the user can decide to continue to the previous view or stay in the current view.

In Android 13 (T / API level 33), the OS introduced support for predictive back-to-home, which shows the user a preview of the home screen when swiping back to exit an app.

With Android 14 (U / API level 34), the OS adds support for in-app predictive back, which apps can take advantage of to show the user previous destinations when swiping back within the app itself.

Design and API Documentation ​

Usage ​

To opt in to predictive back, apps must:

  1. Migrate from the legacy back handling APIs (Activity#onBackPressed, KeyEvent.KEYCODE_BACK, etc.) to the more recently introduced "back callback" APIs (OnBackAnimationCallback, OnBackPressedCallback, etc.). This involves flipping the android:enableOnBackInvokedCallback manifest flag to true, and registering callbacks to handle back pressed on Android T and above. More details on this general back migration can be found at the Framework & AndroidX Predictive Back developer guide.

  2. Upgrade to MDC-Android library version 1.10.0 or above.

Once completing these steps, you will get most of the predictive back animations within Material Components for free on Android U devices. See the section below to understand which components support predictive back and to learn about special considerations for each component.

Predictive Back Material Components ​

The following Material Components support predictive back behavior and animations:

  • Search bar (automatically for SearchView set up with SearchBar)
  • Bottom sheet (automatically for modal, standard requires integration)
  • Side sheet (automatically for modal, standard and coplanar require integration)
  • Navigation drawer (automatically for NavigationView within DrawerLayout)

Note: The Material Components above only automatically handle back on API Level 33+, and when the android:enableOnBackInvokedCallback manifest flag to true. This is to be consistent with the behavior of other AndroidX and Framework views, as well as to avoid taking precedence over any pre-existing back handling behavior that has already been implemented by apps.

Future predictive back support is planned for the following Material Components:

  • Navigation bar / Bottom navigation view
  • Navigation rail

Talks ​

Blog Posts ​

Predictive Back has loaded