TapanHP
TapanHP

Reputation: 6191

Is it possible to change orientation of device when default device rotation is off?

I am using an application for meditation on daily basis, today i was surprised by it because when i rotate screen, App goes to landscape mode, Although the Automatic rotation was off from my settings, How it can happen?

Is there something like Force device to change orientation?

And If default device rotation is off then how app can know that device orientation is changed?

I double checked my phones settings of Auto-Rotation and they were off.I am using Kitkat device.

Upvotes: 1

Views: 112

Answers (2)

Badri nath
Badri nath

Reputation: 51

Yes. you can.

in onCreate method type

this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

this will do the magic.

Upvotes: 1

Hadi
Hadi

Reputation: 159

In AndroidManifest.xml file set activity tag, screenOrientation attribute to fullSensor like this:

<activity
android:name=".MyActivity"
android:screenOrientation="fullSensor" />

Upvotes: 1

Related Questions