Example usage for android.app Activity setRequestedOrientation

List of usage examples for android.app Activity setRequestedOrientation

Introduction

In this page you can find the example usage for android.app Activity setRequestedOrientation.

Prototype

public void setRequestedOrientation(@ActivityInfo.ScreenOrientation int requestedOrientation) 

Source Link

Document

Change the desired orientation of this activity.

Usage

From source file:Main.java

public static void setScreenHorizontal(Activity activity) {
    activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}

From source file:Main.java

public static void setPortrait(Activity activity) {
    activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}

From source file:Main.java

public static void SetOrientation(Activity act, int orien) {
    act.setRequestedOrientation(orien);
}

From source file:Main.java

/**
 * Unlock the orientation of the device//from w w w  .  j  a  v  a 2s. c  o  m
 *
 * @param context the current Activity context
 */
public static void unlockScreenOrientation(Activity context) {
    context.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
}

From source file:Main.java

private static void rotateToPortrait(Activity activity) {
    activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}

From source file:Main.java

private static void rotateToLandscape(Activity activity) {
    activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}

From source file:Main.java

public static void setScreenVertical(Activity activity) {
    activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}

From source file:Main.java

/**
 * Unlocks specified activity's orientation.
 *
 * @param activity activity//w w  w . j a  v a2  s  . c  o  m
 */
public static void unlockOrientation(Activity activity) {
    activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
}

From source file:Main.java

public static void setScreenLandscape(Activity activity) {
    activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}

From source file:Main.java

public static void setScreenPortrait(Activity activity) {
    activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}