Vas
Vas

Reputation: 2064

Activity orientation doesn't get restored

I have activity A that runs in an unspecified orientation. So it can run in both: portrait and landscape. I launch activity B that has to be landscape. In B's onCreate, I check current orientation, if it's portrait then I store it, and then I force landscape via setRequestedOrientation(). When B is done, I want A to appear in the orientation it was in before B was launched (so portrait).

This is where things don't work for me. On cleanup, I read the orientation value that I stored originally, and if it's portrait then I set B to portrait (via setRequestedOrientation()). I tried this in onPause and onDestroy of B. Nothing happens visually. Log reports (via getRequestedOrientation()) that the orientation was indeed changed. However activity A is coming back up in landscape instead of original portrait.

What's the dealio?

PS. Changing orientation back in activity A is not an option.

Upvotes: 1

Views: 53

Answers (1)

android_user77
android_user77

Reputation: 54

Not sure if it helps, but I think you can set android:screenOrientation=" " in the manifest for each Activity.

Upvotes: 1

Related Questions