Android Screen Orientation Check getRotationOffset()

Here you can find the source of getRotationOffset()

Description

get Rotation Offset

License

Apache License

Declaration

public static int getRotationOffset() 

Method Source Code

//License from project: Apache License 

import android.content.Context;
import android.view.Surface;
import android.view.WindowManager;

public class Main{
    public static int getRotationOffset() {
        switch (WindowManagerHolder.WINDOW_MANAGER.getDefaultDisplay()
                .getRotation()) {//from   w ww  .j a va 2s.  c  o m
        case Surface.ROTATION_90:
            return 90;
        case Surface.ROTATION_180:
            return 180;
        case Surface.ROTATION_270:
            return 270;
        default:
            return 0;
        }
    }
}

Related

  1. getDirectionNow(final float direction)
  2. isDefaultToPortrait(Activity activity)
  3. isLandScape(Context context)
  4. isLandscape(final Context context)
  5. reverseDirectionNow(final float direction)