is Orientation Portrait - Android User Interface

Android examples for User Interface:Screen Orientation

Description

is Orientation Portrait

Demo Code


//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;
        }//from  www .j a v  a2 s  . c  o  m
        return true;
    }
}

Related Tutorials