I have faced a strange issue (or maybe unexpected behavior) on my Android device.
The problem is that I am listening for configuration changes in my DialogFragment like this:
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
// Do something secret here :)
}
I added android:configChanges
to the Activity which is responsible for showing the dialog fragment
<activity
android:name=".SecretActivity"
android:configChanges="orientation|screenSize"
android:windowSoftInputMode="adjustResize" />
and indeed I am getting callbacks from the system when I am rotating device, but not in all cases. As you can see in the picture onConfigurationChanged( )
called only when I am rotating 90 degrees, and also 360, in other cases it is not called.
Is this an expected behavior? If yes, how I can detect all rotations (90, 180, 270, 360)?