M
When turning, not only activate, but all the fragments are recreated, but if you activate, and you create fragments, it replaces a re-established automobile with an initial condition. You don't need to manually re-create your fragment onCreate activate if the state is being restored, so you need to add a condition:@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (savedInstanceState == null) {
fragmentTransaction = getSupportFragmentManager().beginTransaction();
fragment = new FragmentList();
fragmentTransaction.replace(R.id.conteiner, fragment);
fragmentTransaction.commit();
}
}
And by the way, in the back of the glass, what do you add? What if he pressed back, he was removed from the actuator and left empty?Also, if you have an activated and fragmented shielding on the screen's orientation, you can just shut off the re-engineering of the activate when you change the orientation by adding an activation in the attribute. android:configChanges="orientation|screenSize|keyboardHidden"