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.
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.
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.