Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.content.res.Configuration; public class Main { public static String getOrientation(Context context) { switch (context.getResources().getConfiguration().orientation) { case Configuration.ORIENTATION_LANDSCAPE: return "Landscape"; case Configuration.ORIENTATION_PORTRAIT: return "Portrait"; default: return ""; } } }