Add this in Android Manifest file:
android:configChanges="orientation"
We can handle the screen orientation of our app in android Manifeast file . Ex :
< activity
android:name="ActivityName"
android:configChanges="orientation|keyboardHidden"
android:label=""
android:screenOrientation=["unspecified" | "behind" |
"landscape" | "portrait" |
"reverseLandscape" | "reversePortrait" |
"sensorLandscape" | "sensorPortrait" |
"userLandscape" | "userPortrait" |
"sensor" | "fullSensor" | "nosensor" |
"user" | "fullUser" | "locked"] >
</activity>
// this all are the options for handling the configuration change
for more details [link text][1]
http://developer.android.com/intl/es/guide/topics/manifest/activity-element.html
We can handle the screen orientation by using Orientation Pro-grammatically .
Example :
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
switch (newConfig.orientation)
{
case Configuration.ORIENTATIONPORTRAIT:
// taking action on event
lockScreenRotation(Configuration.ORIENTATIONPORTRAIT);
break;
case Configuration.ORIENTATIONLANDSCAPE:
// taking action on event
lockScreenRotation(Configuration.ORIENTATIONLANDSCAPE);
break;
case Configuration.ORIENTATIONSQUARE:
// taking action on event
lockScreenRotation(Configuration.ORIENTATIONSQUARE);
break;
default:
throw new Exception("Unexpected orientation!!!");
break;
}
Refer this Link it will definitely helps you. http://techblogon.com/android-screen-orientation-change-rotation-example/
@sujata .... Thank you .......:)
