Java tutorial
//package com.java2s; import android.content.Context; import android.content.res.Configuration; public class Main { /** * returns true if screen is Xlarge so restricts orientation based on that * @param context * @return */ public static boolean isScreenXLarge(Context context) { return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= (Configuration.SCREENLAYOUT_SIZE_LARGE); } }