views:

241

answers:

3

I have an android application that I want to always be running in landscape mode.

I have the following code implemented to keep the app in landscape mode all the time:

inside my activity in the Application Manifest
android:screenOrientation="landscape"

This seems to launch and keep the application in landscape view for the whole duration of the application. Perfect!

However, if I have the app running on my HTC Aria (Android 2.1) and the phone locks, if I unlock the phone, I see the application for probably half a second and it's in portrait orientation and then quickly switches back to landscape mode. It is quite frustrating because all of my views are jumbled around and it looks unprofessional as you can imagine. This happens in both the emulator and on my real phone.

Does anyone know how to stop the application from temporarily rotating when the phone is unlocked?

Additions:
I have tried overriding onConfigurationChanged() but with no success.

I have also tried putting setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); into the onResume() but the app still shows as the incorrect orientation for a split second when the phone is unlocked.

+1  A: 

Try setting the orientation in the manifest file. it might just work.

Umesh
I put android:screenOrientation="landscape" in the manifest, application, and activity node in the manifest but no luck.
justinl
+1  A: 

After looking at many other apps that are made for landscape orientation only, I can see that their apps don't freeze their orientation after standby either. I have a feeling that this is a limitation of the phone, and that all apps will switch to a portrait orientation when the phone is locked. If all apps have this "problem" then I think it is acceptable not to fix.

Please post if you have found out there is a way to stop the forced portrait orientation.

justinl
A: 

This also happens on the motorola droid - I haven't found a way around it.

Futumsh