androidoncreateactivity-lifecyclesplit-screen

How to avoide call onCreate() when app goes to splitView


In my application there have one activity (MainActivity)and four fragment . when my app goes in splitView (Multi Window mode) the onCreate() method get called in MainActivity and that reason first fragment get loaded when i goes to multiWindow mode. How to stop recalling onCreate() method when app goes in splitView.


Solution

  • To avoid calling onCreate() and onDestroy() method in activity when application goes on MultiWIndow mode (SplitView) write android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation" in Manifest file.