Jump to content
  • Advertisement
Sign in to follow this  
Dr Yap

Android custom orientation handler

This topic is 2533 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!