I have a very simple code where I use Action Bar with tab fragments. It works fine after load, but after orientation change it goes crazy. The old fragment also visible (why
I solved this by just looking up the fragment in the tab listener constructor.
public class TabListener implements ActionBar.TabListener
{
private Fragment fragment;
private final SherlockFragmentActivity activity;
private final String tag;
private final Class clazz;
public TabListener(SherlockFragmentActivity activity, String tag, Class clazz)
{
this.activity = activity;
this.tag = tag;
this.clazz = clazz;
FragmentManager manager = ((SherlockFragmentActivity) activity).getSupportFragmentManager();
fragment = manager.findFragmentByTag(tag);
}
...
}