The setRequestedOrientation method is a part of the android.app Activity class and is used to specify the allowed orientation for the activity. This method takes an integer value as a parameter that specifies the allowed orientation. The possible values for this parameter are:
- ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED: The default value, allows orientation changes according to the device's sensor. - ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE: Landscape orientation - ActivityInfo.SCREEN_ORIENTATION_PORTRAIT: Portrait orientation - ActivityInfo.SCREEN_ORIENTATION_SENSOR: Allows orientation changes according to the device's sensor. - ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE: Reverse landscape orientation - ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT: Reverse portrait orientation
Examples: 1. To set the screen orientation of an activity to landscape, the following code can be used:
Java Activity.setRequestedOrientation - 30 examples found. These are the top rated real world Java examples of android.app.Activity.setRequestedOrientation extracted from open source projects. You can rate examples to help us improve the quality of examples.