Code example for Display

Methods: getRotation

0
    } 
 
    public static String getRotation(final Context context) {
        final WindowManager wm = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
        final Display display = wm.getDefaultDisplay();
        switch (display.getRotation()) {
        case Surface.ROTATION_90:
            return ROTATION_90;
        case Surface.ROTATION_180:
            return ROTATION_180;
        case Surface.ROTATION_270:
            return ROTATION_270;
        case Surface.ROTATION_0:
        default: 
            return ROTATION_0;
        } 
    } 
} 
Contextual code suggestions in your IDE  Get Codota for Java