Navigate to menu on back button press
Posted
by
GAMA
on Stack Overflow
See other posts from Stack Overflow
or by GAMA
Published on 2012-06-20T09:04:30Z
Indexed on
2012/06/20
9:16 UTC
Read the original article
Hit count: 216
android
|android-activity
I'm navigating from:
Main activity
toActivity 2
Activity 2
toActivity 3
Activity 3
toActivity 4
through Intent
.
I've also created the menu so that user can directly navigate from Activity 4
to Main activity
.
But after navigating from Activity 4
to Main activity
by using menu, when I press back, it takes me to Activity 3
rather than exiting the application.
I tried:
@Override
public void onBackPressed() {
super.onBackPressed();
MainActivity.this.finish();
}
But no gain. Any suggestions?
© Stack Overflow or respective owner