When I press the back button in MainActivity the home screen is shown, however onDestroy is not being called. Is it a new feature? Using Emulator Pixel 3A in API 33 arm 64-v8a. The same happens through the phone pixel 6A API 33. Also local variables are not deleted.
It should have destroyed MainActivity when the back button is pressed
On Android 12+ Devices, back button doesn't result in (main) Activity being destroyed instead app will stay in warm state, similar to when exiting using home button.
Reason behind this change is now user can quickly resume app from a warm state, instead of having to completely restart the app from a cold state.
If you want it function like before then there are two workaround that you can use:
1. Using AndroidX Activity APIs
2. By overriding onBackPressed()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With