Java tutorial
//package com.java2s; import android.content.Context; import android.content.res.Configuration; public class Main { public static boolean isPortrait(Context context) { return isPortrait(context.getResources().getConfiguration()); } public static boolean isPortrait(Configuration newConfig) { if (newConfig != null && newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { return false; } return true; } }