Java tutorial
//package com.java2s; //License from project: Mozilla Public License import android.graphics.drawable.BitmapDrawable; public class Main { /** * Image Orientation constants - portrait. */ public static final String IMAGE_ORIENTATION_PORTRAIT = "portrait"; /** * Image Orientation constants - landscape. */ public static final String IMAGE_ORIENTATION_LANDSCAPE = "landscape"; /** * Determine if the image orientation is landscape or portrait. * * @param drawable * @return IMAGE_ORIENTATION_PORTRAIT or IMAGE_ORIENTATION_LANDSCAPE. */ public static String isLandscapeOrPortrait(BitmapDrawable drawable) { int width = drawable.getBitmap().getWidth(); int height = drawable.getBitmap().getHeight(); if (width > height) { return IMAGE_ORIENTATION_LANDSCAPE; } else { return IMAGE_ORIENTATION_PORTRAIT; } } }