android - 如何在语言环境更改时销毁应用程序

标签 android locale

在我的多语言应用程序中,我想从启动器 Activity 中重新启动我的应用程序。但我无法这样做。我通过删除

更改了应用程序 list

locale

来自

android:configChanges="orientation|keyboardHidden"

但它对我不起作用。 list :

 <application
        android:name=".Global.MyApp"
        android:allowBackup="true"
        android:icon="@drawable/login_meter"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
.....
.....
 <activity
            android:name=".SplashActivity"
            android:configChanges="orientation|keyboardHidden"
            android:launchMode="singleTask"
            android:screenOrientation="portrait"
            android:theme="@style/SplashTheme"
            >
            <intent-filter>
                ....

            </intent-filter>
        </activity>

....
....

</application>

最佳答案

有一个Intent 对于 Locale 更改操作。 你应该注册 BroadcastReceiver 来捕获这个 Intent 并在 onReceive() 方法中做任何你想做的事情。

关于android - 如何在语言环境更改时销毁应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41261445/

相关文章:

java - I18n - 数据位于一种语言环境中,ui 位于另一种语言环境中,我应使用哪种语言环境进行排序?

android - 在每应用程序语言首选项 list 中没有引用 AppLocalesMetadataHolderService

java - 如何从数组中获取随机文本字符串, "loop-animation"就像彩票一样?

java - Android Manifest- Intent 过滤器和 Activity

android - 在 Android 应用程序更新 Dagger 期间找不到符号 newDispatchingAndroidInjector

javascript - 我可以让我的浏览器像在另一个语言环境中一样呈现页面吗?

Bash:除了更新语言环境之外,通过导出设置的语言环境有什么不同吗?

python - 将 'decimal-mark' 千位分隔符添加到数字

适用于 Google TV 的 Android 应用显示 0 台设备

android - 接收可能需要很长时间的请求的响应