Method ran when user press Back key on Android
I'm developing an Android 2.2 application.
I want to know which activity method is ran when user press b开发者_如何学Pythonack key.
I have found this: "When the user presses the BACK key, the current activity is popped from the stack, and the previous one resumes as the running activity. "
But it doesn't tell what method is ran.
Thanks.
In Android 2.2, pressing the BACK button triggers onBackPressed()
in your activity. The default implementation of onBackPressed()
calls finish()
.
onKeyDown
and onBackPressed
精彩评论