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:
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
I'm trying to add a fragment to an activity after the content view in the activity has been set. I'm not using the compatibility package and have my target API set to 16. I'm expecting the activity to be set to the fragments layout after the setContentView method in the main activity but on runtime, the fragment is never added and the screen in blank.