android get current screen orientation

The current configuration ( orientation as well) can be available from the Resources' Configuration object as:
The return parameter may be one of ORIENTATION_LANDSCAPEORIENTATION_PORTRAIT, or ORIENTATION_SQUARE.



public static int getScreenOrientation(){    
    return getResources().getConfiguration().orientation;
}

check http://developer.android.com/reference/android/content/res/Configuration.html#orientation for details

No comments :

Post a Comment

Your Comment and Question will help to make this blog better...