I am working in an android application in 2.2 and I want to set my application in landscape
mode.
For that I added in my manifest
with every activity tag android:screenOrientation="landscape"
and it worked fine.
But it comes only in one side. If I turn the device again upside down it fit in the same position in landscape
mode. How can I have landscape mode in both the side of the device. Please help me.
Thanks in advance.
I am not sure about 2.2 but if you're building your app for Android 2.3 and newer you can set in activity manifest
android:screenOrientation="sensorLandscape"
If you're building your app for Android 2.2 and older but want to run it on Android 2.3 and newer as a "sensorLandscape" configuration, you could try something like this
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
}