I have an activity where I am calling three fragments - each depending on each other:
A(ctivity) -> f1 (Fragment one, title {is|should}: list) -> f2 (Fragment two, title {is|should}: overview) -> f3 (Fragment three, title {is|should}: detail)
ATM I use the following method call to jump backwards:
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
FragmentManager fragmentManager = getSupportFragmentManager();
if (fragmentManager.getBackStackEntryCount()>0){
fragmentManager.popBackStack();
}
}
}
This works fine.
I am overriding the ActionBar title in each fragment like this:
ActionBar bar = getSherlockActivity().getSupportActionBar();
bar.setTitle(R.string.title_f3);
When navigating forward (like shown above) this works flawlessly but navigating backwards the title of the ActionBar isn′t updated:
f3 (title {is|should}: detail) -> f2 (title {is}: detail, {should}: overview) -> f1 (title {is}: detail, {should}: list)
Obviously I could just update it again when the fragment is shown. But my debugger never stops in any of the methods I′d except which would be called like onResume().
So is there actually any method being called in a previous fragment after popBackStack() ?
See Question&Answers more detail:os