I have a TabHost with 5 fragments. One of the Fragments leads to an Activity. When I press the back button in that activity it will lead me back to the fragment that started the activity, however if I press the home-up button in the actionbar it leads me back to the first tab's fragment. How can I make it go back to the fragment that called like the back button does when I press the home up button?
Asked
Active
Viewed 130 times
1 Answers
0
you need to override the action for the home button
in your activity -
@Override
public boolean onOptionsItemSelected(MenuItem item){
if(item.getItemId() == android.R.id.home){
onBackPressed();
return true;
}
return super.onOptionsItemSelected(item);
}
this should cause the 2 behaviors (back button and home up) to be identical

Shooky
- 1,269
- 8
- 16
-
this exhibits the same behavior as I described. There is no difference. – Max Kleine Jan 14 '15 at 09:13
-
you're gonna need to post some code to get some more specific help. Preferably the calling fragment and the activity it opens. – Shooky Jan 14 '15 at 13:59