Reputation: 644
My Android application works only in portrait orientation. Landscape mode is disabled with
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT).
But i have a dialog with a signature view (custom view) and a user uses it for drawing his signature. It gives a bitmap as a result. I also have an ImageView for saved signature preview which displays the bitmap described above. A user can hold his device as he wants while drawing a signature. So, my application should rotate resulting bitmap according to current screen position. For instance, a user draws his signature with angle = 90 degrees and i want to rotate the bitmap at 90 degrees and my application will display the signature bitmap in portrait mode properly. The problem is that only portrait mode is supported and the following approaches doesn't work:
int rotation = getResources().getConfiguration().orientation;
or
int rotation = getWindowManager().getDefaultDisplay().getOrientation();
The result for these statements is always 0.
So, how i can get a current position of device in case an orientation changing is disabled?
Upvotes: 1
Views: 717
Reputation: 2774
You could make your dialog a separate activity, and make it not restricted to portrait orientation.
Upvotes: 1