Java tutorial
//package com.java2s; import android.app.Activity; import android.content.res.Configuration; public class Main { public static boolean isOrientationPortrait(Activity activity) { int orientation = activity.getResources().getConfiguration().orientation; switch (orientation) { case Configuration.ORIENTATION_LANDSCAPE: return false; case Configuration.ORIENTATION_PORTRAIT: return true; } return true; } }