Skip to main content
GameDev.net gamedev.net
🔒 Locked

Android custom orientation handler

Started by Dr Yap Dec 21, 2011 at 7:08 PM 1 replies 1.7k views
Original Post
Dr Yap
Dr Yap
Orientation on an Android device is never nice to look at. I am looking for a way to be able to preferably receive a signal from the OS, or else read it from the sensors, which would tell me that the screen has been rotated. I could then make the transition smoother by rotating the components on the screen instead of Android resetting the graphics device.

Is there a way to receive such a signal and stop Android from handing the orientation change?

I haven't found anything along these lines from my searching but would be grateful for your input and any links you might have.
Dr Yap
Dr Yap
I have found a solution to this by using the manifest file. In the activities tag you need to add

android:configChanges="orientation"
Which means that by overriding onConfigurationChanged in the activity you will receive a notification when the screen is rotated.
compscialien
compscialien
Upon looking it up myself, that seems to be the most widely used solution. While maybe not the most elegant, it certainly gets the job done. This is a good find.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.