Reputation: 453
I know that when we press back button, the default function onBackPressed()
is called.
http://developer.android.com/reference/android/app/Activity.html#onBackPressed()
This doc say that "The default implementation simply finishes the current activity".
What does it means, does it mean the default onBackPressed() include the function finish()
?
What is the implementation inside finish()?
Is that onDestroy()
?
Upvotes: 0
Views: 1945
Reputation: 9103
This is how implementation looks like:
public void onBackPressed() {
if (!mFragments.popBackStackImmediate()) {
finish();
}
}
Of course on Android 2.3 and lower it's like this:
public void onBackPressed() {
finish();
}
There was no Fragments API.
You can always check sources yourself in your IDE or on the web
Upvotes: 5