VansFannel
VansFannel

Reputation: 45931

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 back 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.

Upvotes: 0

Views: 858

Answers (2)

CommonsWare
CommonsWare

Reputation: 1007265

In Android 2.2, pressing the BACK button triggers onBackPressed() in your activity. The default implementation of onBackPressed() calls finish().

Upvotes: 2

Phyrum Tea
Phyrum Tea

Reputation: 2653

onKeyDown and onBackPressed

Upvotes: 1

Related Questions