0

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());
    }
Krishna
  • 343
  • 5
  • 22
Pramod mishra
  • 615
  • 6
  • 16

1 Answers1

2

You just have to add android:configChanges="orientation|screenSize" to your Activity in manifest file.

it won't recreate your Activity.

V-rund Puro-hit
  • 5,518
  • 9
  • 31
  • 50