Application in fixed landscape. How to detect phone orientation
I'm building android app that is only in landscape mode. How can i detect the phone orientation as fast as开发者_如何学编程 possible? I have tried with
`Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay();
display.getOrientation();`
and also with the SensorEventListener
, but I can't get any values for X,Y or Z? How can I do this? any solution? I was using this example for sensor.
link for the sensor event listener
To keep an activity only in portrait mode add this in the manifest xml tag
android:screenOrientation="portrait"
精彩评论