List of utility methods to do Screen Orientation Set
int | getDisplayRotation(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: ... |
void | setScreenHorizontal(Activity activity) set Screen Horizontal activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); |
void | setScreenVertical(Activity activity) set Screen Vertical activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); |
void | setOrientation(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"); ... |