The question might be dumb but I'll ask it, for example I have 3 Activities, Activity 1,2,3.
Activity 1, I click a button, goes to Activity 2 Activity 2, I click a button, goes to Activity 3. Activity 3, I click the back button, I want it to go back to Activity 1. Any idea how to do it? Sorry Android Newbie. Thanks!
override onbackpressed method and just do like this:-
@Override
public void onBackPressed() {
Intent intent = new Intent(Activity3.this,
Activity1.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP
| Intent.FLAG_ACTIVITY_SINGLE_TOP);
startActivity(intent);
}
Enjoy....!