ActionBar Tabs with fragments on rotate

I’am build an app with an ActionBar and two Tabs below.
Everything works fine if the device / emulator isnt rotated. If rotated, tab state switches automaticale to tab1 (normal, because onCreate get called) but the content dont get changed. If I select a tab in the new orientation, the onCreateView() method from the selected Fragment get called but the view dont get updated (stay always the same). Any Tips?

The code.

  • Cannot compile, Unable to execute dex, cannot merge, non-jumbo instruction
  • Unresolved reference: Kotlin needs 2 builds after clean to pick up code when using kapt
  • How can I get a working vertical SeekBar in Android?
  • Universal Image Loader gridview blinks after notifyDataSetChanged call
  • Android Listview - can not select multiple items when using a cursor
  • How can I execute something just once per application start?
  • Main Activity:

        ActionBar actionbar = getActionBar();
        actionbar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
    
        ActionBar.Tab ATab = actionbar.newTab().setText(R.string.player);
        ActionBar.Tab BTab = actionbar.newTab().setText(R.string.stations);
    
        Fragment AFragment = new AFragment();
        Fragment BFragment = new BFragment();
    
        PlayerTab.setTabListener(new MyTabsListener(AFragment));
        StationsTab.setTabListener(new MyTabsListener(BFragment));
    
        actionbar.addTab(ATab);
        actionbar.addTab(BTab);
    

    With identical tabs that display a simple textview. The textview simple say which tab is selected.

    Fragments:

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.a, container, false);
    }
    

    The Fragment layout, mentioned above, only contains a TextView with hardcoded Text. (Only for testing purposes)


    The Main layout looks like this.

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >
    
    
        <LinearLayout
            android:id="@+id/fragment_container"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >
     </LinearLayout>
    
    </LinearLayout>
    

    Related posts:

    How to create a custom navigation drawer in android
    Unable to resolve class in build.gradle using Android Studio 0.60/Gradle 0.11
    Navigate among fragments within one activity
    What&#039;s the best way to do &ldquo;application settings&rdquo; in Android?
    Android + App engine: user.getUserID() is null in endpoint
    ClassCastException: CustomFragment cannot be cast to android.app.Fragment / Using android.support.v4...
    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.