Bringing Predictive Back Gestures to your App
summary
Timeline of platform changes (onBackInvoked in Android 13, onBackAnimationCallback in 14, enabled by default in 15) maps to a concrete recipe: use the predictive back handler from androidx.activity + the Compose predictiveBackHandler flow, drive a manual seekable transition state (seekTo/animateTo) to reflect gesture progress, handle CancellationException to rewind, and upgrade to Navigation Compose 2.8.0-alpha02 for built-in support. Demo app shows gesture side, progress, X/Y positions, works for bottom sheets and shared-element effects but occasionally has visual bugs.
AI-written summary · about
chapters (11)
- 0:00Introduction
- 1:06Android back gestures history
- 3:15Predictive back API evolution
- 4:38Jetpack navigation support
- 5:41AndroidX activity API
- 7:04Custom back host with predictive back
- 9:15Integrating back handler
- 11:05Demo: back handler features
- 13:37Custom transitions with back
- 14:42User feedback with back gestures
- 15:03Summary
related talks
33mGesture navigation best practices
14mBasics for System Back
43mBuilding for the Future of Android
33mWhat's up with Android's back?
27mA window into transitions
36mNavigating the future with Jetpack Navigation 3
20mAdvanced Android Touches
12mDesigning a high quality app with the latest Android features
