Tristan
Tristan

Reputation: 9111

Landscape/portrait orientation for my first app: why is it stuck?

I've just deployed the "first app" demo from Android Studio on a Nexus 10 emulator and on my physical Nexus 10 (API 22 / Lollipop 5.1).

On the emulator, when I change the orientation, the app rotates, but on my physical device it doesn't, it's stuck in landscape.

I've checked VLC rotates fine on my physical device for example, so the sensor is not the problem.

Upvotes: 1

Views: 571

Answers (1)

Aman Rawat
Aman Rawat

Reputation: 395

If you want to change your screen orientation based on sensors use the below code

activityContext.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR);

Thats what VLC does rotates screen based on Sensors.

Upvotes: 2

Related Questions