Android – Modify Screen Orientation

The screen orientation is determined in the Activity class.

public class Test extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
    	super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        //set screen orientation to landscape
        this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
        ...code...

Done =)

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.