Search code examples
androidandroid-layoutandroid-orientationandroid-screen

Is there a device and interface orientation in Android (like in iOS)?


Is there a way to get the device orientation in Android even if the interface orientation remains the same? I turn the device 180 degrees, the UI is upside down. But I still want to be notified.


Solution

  • You should set up an OrientationEventListener in the Activity you want to be notified of changes in.

    Then you will have to specify the desired ScreenOrientation in the manifest for that Activity to prevent the screen from rotating.