I want to change screen orientation for each fragment independently in my app (i.e. fragment A is landscape only and fragment B is portrait only) just like I can do that for activities using AndroidManifest.xml.
When I create my fragments I pass a scecific screen orientation constant for each fragment using Fragment.setArgunents(..).
This link provide a visualization of the lifecycle for activity and fragment.
But it didn't really mention the full lifecycle when fragment is being triggered from an activity.
Can someone please explain what is the sequence of method will be triggered (both fragment and activity) when users change the device orientation?
Will this be the sequence:
One of my fragments have a listview that gets his adapter from my service at beggining of the fragment lifecycle. On normal lifecycle it goes without problems, but when i rotate the device, the fragment that was showing is recreated even before activity recreation, thus my service instance on activity is not ready, it is only ready after onServiceConnected().
I have an activity with 2 fragments, and one inner-fragment or nested-fragment.
The flow of how activity and fragments are created:
Activity -> fragment 1 -> fragment 2 + nested-fragment
fragment 1 is added to the layout when activity is created
fragment 2 is created when a button is pressed from fragment 1.
fragment 1 is replaced with fragment 2.
When fragment 2 is created, automatically the