Search code examples
javaandroidscreen-orientationactivitygroup

Android ActivityGroup Screen Orientation


I am facing a serious issue and i cant find any answers for on the internet. In my application i have an activity group which contains four activities. In the activity which extends activity group i haven't specified the screen orientation code fragment,

setRequestedOrientation(1); And in the other 3 activities i have mentioned it to be portrait. And all the activities works fine in portrait mode. But i need one activity to change the orientation when the device rotates. For that activity i havent specified the setRequestedOrientation(1) code. But That activity does not change according to the device rotation.

Has anyone came across an error like this. Any help would be greatly appreciated. Thanks in advance.


Solution

  • As you have said, you have ActivityGroup and it contains 4 activities, you are setting Portrait mode to all the activities except one.

    Now, I am sure its happening due to your ActivityGroup is having Portrait setting in AndroidManifest file, if you remove then your whole ActivityGroup would be working in both the orientation. If you keep it as Portrait or Landscape then your sub-activities (i.e. Views) will be in the same orientation as your ActivityGroup has.