Java tutorial
//package com.java2s; //License from project: Apache License import android.content.res.Configuration; public class Main { private static String UNKNOWN = ""; /** * Overall orientation of the screen. * @param orientation "orientation" */ @SuppressWarnings("deprecation") public static String getOrientationStr(int orientation) { switch (orientation) { case Configuration.ORIENTATION_UNDEFINED://0 return "ORIENTATION_UNDEFINED"; case Configuration.ORIENTATION_PORTRAIT://1 return "ORIENTATION_PORTRAIT"; case Configuration.ORIENTATION_LANDSCAPE://2 return "ORIENTATION_LANDSCAPE"; case Configuration.ORIENTATION_SQUARE://3 return "ORIENTATION_SQUARE"; default: return UNKNOWN; } } }