Hi everyone:
Guess I need some help on how to use the ActionBar in combination with
Fragments.
Simple App Structure:
Activity A
Fragment 1
Fragment 2
Activity A loads, starts Fragment 1. Fragment one contains code to set
the ActionBar:
@Override
public void onResume() {
super.onResume();
ActionBar bar = getSupportActivity().getSupportActionBar();
bar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
bar.setListNavigationCallbacks(new
SimpleSpinnerArrayAdapter(getActivity()), this);
}
At some point, Activity A starts Fragment 2, by adding it to the stack
and overlaying. Also, Fragment 2 will revert the ActionBar to the
plain one.
public void showStationList(View view) {
String tag = (String) view.getTag();
if (tag != null && tag.length() > 0) {
FragmentTransaction ft =
getSupportFragmentManager().beginTransaction();
StationListDialog fragment = new StationListDialog(tag.split(","));
ft.add(R.id.f_long_distance, fragment);
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
ft.addToBackStack(null);
ft.commit();
}
}
Problem is: When pressing the back button, means when coming back to
Fragment A, the ActionBar is not restored to the state Fragment A
needs it.
I guess onResume is wrong (as it's not called as well). But I cannot
find the proper place to put this into.
Any suggestion?
Thanks,
Sebastian
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en