There are many questions that try to address onBackPressed()
being deprecated.
The general answer seems to be: "Replace it with onBackPressedDispatcher.onBackPressed()
. However, when I do that I lose animations. When I started an intent with a slide in/out animation, calling Activity.onBackPressed()
will respect this animation, but onBackPressedDispatcher.onBackPressed()
wont (it does some fading animation instead).
So how can I replace the deprecated Activity.onBackPressed()
without losing custom activity animations?