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
Hai, I got Solution with the help of Georgy Gobozov, But that solution has to be refined as shown below to work it properly,
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
if(newConfig.equals(Configuration.ORIENTATION_LANDSCAPE))
{
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
else if(newConfig.equals(Configuration.ORIENTATION_PORTRAIT))
{
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
}