Android examples for android.app:Display
get Display Rotation via Activity
import android.app.Activity; import android.view.Surface; public class Main { public static int getDisplayRotation(Activity activity) { int rotation = activity.getWindowManager().getDefaultDisplay().getRotation(); switch (rotation) { case Surface.ROTATION_0: return 0;//from ww w .j a v a2 s.c o m case Surface.ROTATION_90: return 90; case Surface.ROTATION_180: return 180; case Surface.ROTATION_270: return 270; } return 0; } }