Question

I have used following code in activity onCreate() to lock view only to landscape mode, it is perfectly working on device but not working on emulator, Since i dont have a device now it's hard to develop

code :

  setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
  setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);

Please help

Was it helpful?

Solution

Try this:

android:screenOrientation="sensorLandscape"

Put this Code[Attribute] in Activity tag of AndroidManifest.xml file it should work.

OTHER TIPS

In your manifest file simply add

  <activity
            android:name="yourActivity name"
            android:screenOrientation="portrait" >
        </activity>

Apologies if this is too obvious.. You have to manually put your emulator in landscape mode, I think. I think it's the F9 key, but it's been a while since I've done that.

Try this way, hope this will help you.

Define this attribute "android:screenOrientation="landscape"" as your activity in AndroidManifest.xml

Try this

Put below line of code in your manifest

<activity>
android:screenOrientation="landscape"
</activity>

It works for me....

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top