1

I want to be notified when screen rotation happens. How can I do this using the sensors?

I can't use onConfigurationChanged, because I use fixed orientation on my application.

pitfall
  • 166
  • 1
  • 4

1 Answers1

0

When screen rotates (assuming OS and your app permits it), your activity is redrawn - basically, finished and recreated. You can figure out which position the phone is at the moment in by using this in your activity:

getResources().getConfiguration().orientation

The result of the call will be one of these: ORIENTATION_PORTRAIT and ORIENTATION_LANDSCAPE

You can take a look here, this is related to your question.

Community
  • 1
  • 1
C0D3LIC1OU5
  • 8,600
  • 2
  • 37
  • 47
  • No, in a fixed orientation, this parameter does not change. I know it can be done by means of sensors, but I do not know how. – pitfall Jun 11 '14 at 21:19
  • in your situation, i think yo may need to use one of the phones sensors: http://developer.android.com/guide/topics/sensors/sensors_motion.html – C0D3LIC1OU5 Jun 11 '14 at 21:30