Saturday, September 24, 2011

Android - Stop/Disable Orientation

Add the Following Lines:

In AndroidManifest.xml


Find the Activity section in which you want stop/disable the orientation and add the following attribute


android:configChanges="keyboardHidden|orientation"


In the Activity(In which you want to stop/disable orientation) class add the following code:



@Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }

No comments:

Post a Comment