I want to change the screen orientation from portrait to landscape and vice versa when the user rotates his Android mobile phone clockwise/anticlockwise. Can anyone help me how
Just add to your AndroidManifest in activity
android:configChanges="keyboardHidden|orientation"
Then you should override this method in your activity
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
setContentView(R.layout.myLayout);
}
And use search, this question is very popular.