Android Orientation Changes

So we have a requirement, where sometimes your screen needs to be one orientation for a certain situation or screen size.. So that rules out using:


As this will stop your Activity from using all orientations in other sizes/views etc.

So, what do we do?

public void onCreate(Bundle savedInstanceState) {  
  //If normal do..
  //Else do something else  setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR);

Job done! You can change the orientation to your hearts content. Great for, forcing your user into full screen mode landscape when playing a video for example.

comments powered by Disqus