When you set android:configChanges
in the manifest, that means you are telling the system that you will handle the configuration change yourself manually in the Activity
.
From the doc of android:configChanges
:
Lists configuration changes that the activity will handle itself. When
a configuration change occurs at runtime, the activity is shut down
and restarted by default, but declaring a configuration with this
attribute will prevent the activity from being restarted. Instead, the
activity remains running and its onConfigurationChanged() method is
called.
So if you set the configChanges
in the manifest, you have to override the onConfigurationChanged()
callback and handle the change. Otherwise the system will handle the change automatically -- like loading a proper resource -- and you don't have to override the onConfigurationChanged()
callback.
Also from the doc:
Using this attribute should be avoided and used only as a last resort.