Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import android.content.res.Configuration; public class Main { private static String getOrientation(Context ctx) { String orientation = "unknown"; switch (ctx.getResources().getConfiguration().orientation) { case Configuration.ORIENTATION_LANDSCAPE: orientation = "landscape"; break; case Configuration.ORIENTATION_PORTRAIT: orientation = "portrait"; break; } return orientation; } }