It was not called super.onConfigurationChanged(newConfig);
so the method became
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
System.out.println("Configuration Changed");
Configuration c = getResources().getConfiguration();
if (c.orientation == Configuration.ORIENTATION_PORTRAIT) {
// portrait
} else if (c.orientation == Configuration.ORIENTATION_LANDSCAPE) {
// landscape
}
}
and also added android:configChanges="orientation|screenSize"
in manifest.
Thanks SSS :-)