Android的 - 区域设置的通知,需要转储缓存 [英] android - locale notification, need to dump cache

查看:110
本文介绍了Android的 - 区域设置的通知,需要转储缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在提供本地化的应用能够轻松地切换语言。一切都很好地工作,除了实际在导航部分缓存的值。我们有两种选择:


  1. 这是语言的变化完全重新启动应用程序 - 在这种情况下,我需要一个通知,强制重启


  2. 只是加载新的字符串到表 - 在这种情况下,需要更换字符串值和rbuild自定义导航状态。


在这两种情况下,我们需要一种方法来找出语言切换时。有没有我们可以听的意图是什么?如果是的话你能不能请告知哪一个?我想到的是去同一个广播接收器。我只是不知道这是哪个意图的行动。在下面的例子中有什么SOME_ACTION价值?

先谢谢了。

 <接收机器人:名字=com.v1.application.notifications.LanguageChangeReceiver>
            &所述;意图滤光器>
                <作用机器人:名字=android.intent.action.SOME_ACTION/>
            &所述; /意图滤光器>
        < /接收器>


解决方案

<一个href=\"http://developer.android.com/reference/android/content/Intent.html#ACTION_CONFIGURATION_CHANGED\"相对=nofollow> android.intent.action.CONFIGURATION_CHANGED

We are localizing our app to be able to easily switch between languages. Everything works nicely except for some cached values that are actually in navigation. We have two options:

  1. completely restart app on language change - in this case I need a notification and force restart

  2. just load new strings into the table - in this case it will require to replace string values and rbuild custom navigation state.

IN both cases we need a way to find out when language switches. Is there an intent we can listen to? If yes could you please advise on which one? I am thinking to go with a broadcast receiver. I am just not sure which intent action it is. In below example what is the SOME_ACTION value?

Thanks in advance.

 <receiver android:name="com.v1.application.notifications.LanguageChangeReceiver">
            <intent-filter>
                <action android:name="android.intent.action.SOME_ACTION" />
            </intent-filter>
        </receiver>

解决方案

android.intent.action.CONFIGURATION_CHANGED

这篇关于Android的 - 区域设置的通知,需要转储缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆