Reputation: 625
I have a base class for managing fragment inside my Activity. which handles fragment backstack,opening etc. but on Orientation change this object become null and i loss all my fragment state.
public class Dashboard extends AbstractNavDrawerActivity implements AsyncRequest
.OnAsyncRequestComplete {
BaseFragmentOrganizer fragmentOrganizer;//object that manages backstack and other operation
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//on orientation change fragmentOrganizer becomes null so no more backstack.
if (savedInstanceState == null) {
fragmentOrganizer = new MainFragmentOrganizer(getSupportFragmentManager());
}
Upvotes: 0
Views: 341
Reputation: 5534
You just have to add android:configChanges="orientation|screenSize"
to your Activity in manifest
file.
it won't recreate your Activity.
Upvotes: 2