Android examples for android.app:Screen
Check Screen Orientation by comparing the weight and height
import android.app.Activity; import android.content.pm.ActivityInfo; public class Main { public static int ScreenOrient(Activity activity) { int landscape = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; int portrait = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; int width = activity.getWindowManager().getDefaultDisplay().getWidth(); int height = activity.getWindowManager().getDefaultDisplay().getHeight(); return width > height ? landscape : portrait; }/*from w w w. j a v a 2 s . c om*/ }