In my application i just overriden the method onConfigurationChanged method as given below
@Override
public void onConfigurationChanged(Configuration 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
}
}
But it is not beeing called when the screen orientation is called.
In manifest my Activity is like this
<activity
android:name=".MainActivity"
android:configChanges="orientation"
android:label="@string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
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 :-)