I have three fragments in my DrawerLayolut:
- Fragment A 
- Fragment B 
- Fragment C - By default (in the init of the app) I load the - FragmentA: and, if I go to the, for instance,- FragmentBworks well.
Problem: when I rotate my screen in the FragmentB, I come back to the FragmentA.
I don't know how to avoid this. I tried with the next code in the onCreate of the AppCompatActivity:
Fragment mFragment = null;
if(getSupportFragmentManager().findFragmentById(R.id.myframe) == null) {
   mFragment = new CalendarioFragment();
   getSupportFragmentManager().beginTransaction().add(R.id.myframe, mFragment ).commit();
} else {
   if(mFragment instanceof FragmentA){
       mFragment = (FragmentA) getSupportFragmentManager().findFragmentById(R.id.myframe);
   }else if(mFragment instanceof FragmentB){
       mFragment = (FragmentB) getSupportFragmentManager().findFragmentById(R.id.myframe);
   }else if(mFragment instanceof FragmentC){
       mFragment = (FragmentC) getSupportFragmentManager().findFragmentById(R.id.myframe);
   }
}
But doesn't work as I expected... Could, please, somebody help me with my problem? Please, any help is welcome
I read about this other solution:
<activity android:name="CalActivity" android:configChanges="orientation|keyboardHidden"/>
But I think this isn't recomendable... (and doesn't work for me)
 
     
    