Did Back Key Destroy An Activity?
I have an activity defined as below: A strange thing is that, when ru
Solution 1:
When activity is in the background (after pressing Back key) it is always stopped but System can also decide to destroy it (eg. when system resources are low). You can't determine when it will be destroyed.
Activity can also be destroyed by calling finish(). You can determine that by checking isFinishing() status in onPause or onStop callback.
Do not count on onDestroy callback. If system will kill activity it wont be called.
Solution 2:
By default, pressing the BACK key finishes (destroys) the current activity and displays the previous activity to the user.
Post a Comment for "Did Back Key Destroy An Activity?"