0

I added this in my onCreate method.

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

And now I want to determine which side user is trying to rotate the phone. How can I do that?

The user can't rotate the screen, but I want to determine weather he is trying or not.

Armen Apresyan
  • 65
  • 1
  • 10

2 Answers2

0

Use this:

Display display = ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
int rotation = display.getRotation();

I think this helpful for you: how to detect orientation of android device?

Community
  • 1
  • 1
xxx
  • 3,315
  • 5
  • 21
  • 40
0

Check this out

this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE
Vinoth Vino
  • 9,166
  • 3
  • 66
  • 70