Android Utililty Methods Screen Orientation Set

List of utility methods to do Screen Orientation Set

Description

The list of methods to do Screen Orientation Set are organized into topic(s).

Method

intgetDisplayRotation(Activity activity)
get Display Rotation
int rotation = activity.getWindowManager().getDefaultDisplay()
        .getRotation();
switch (rotation) {
case Surface.ROTATION_0:
    return 0;
case Surface.ROTATION_90:
    return 90;
case Surface.ROTATION_180:
...
voidsetScreenHorizontal(Activity activity)
set Screen Horizontal
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
voidsetScreenVertical(Activity activity)
set Screen Vertical
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
voidsetOrientation(Activity activity, String orientation)
set Orientation
if (orientation.equals("LANDSCAPE")) {
    Log.i(TAG, "Forcing orientation to landscape");
    activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
} else if (orientation.equals("PORTRAIT")) {
    Log.i(TAG, "Forcing orientation to portrait");
    activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
} else if (orientation.equals("AUTOMATIC")) {
    Log.i(TAG, "Automatic orientation");
...