How to retain async task during screen oreintation. I have searched it much but not found any elegant solution to it.
What are my issues ::
I am having different layouts for portrait & landscape so cannot use
android:configChanges="keyboardHidden|orientation|screenSize"to restrict activity recreation.I cannot use
Fragment.setRetainInstance(boolean)as I am having nested fragments so I am adding fragments to back stack usingaddToBackStack()In this situation :
onCreate()andonDestroy()are not called. This is metioned in the API docs.A bundle passed from
onSaveInstanceState()is not received inonCreateView(). The passed-in Bundle is null. So I will not get the saved instance of theactivity
How to retain a async task in fragments to avoid crashing on orientation change.
Or is there any other way for performing asynchronous task.