android语言切换导致新建了Activity

当前的activity切换到后台,切换语言,回到原来的activity,原来的activity不见,出现又一新activity。

原因:没有在AndroidManifest.xml 中申明android:configChanges

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.

解决在AndroidManifest.xml中申明 android:configChanges="locale"

原文地址:https://www.cnblogs.com/zhuqiang/p/2871564.html