Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
"Auto-detecting Device Orientation Whilst Allowing User to Override" for GameDevAlgorithms.com
@Override
protected void onResume() {
super.onResume();
//noinspection ResourceType
setRequestedOrientation(Setting.get(Enums.Setting.Orientation).getIntValue());
}
public final static int ORIENTATION_AUTO = 4;
public final static int ORIENTATION_LANDSCAPE = 6;
public final static int ORIENTATION_PORTRAIT = 7;
private int getOrientationValue(int position) {
switch (position) {
case 1: return Constants.ORIENTATION_LANDSCAPE;
case 2: return Constants.ORIENTATION_PORTRAIT;
default: return Constants.ORIENTATION_AUTO;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment