如何得到通知在Android中,当系统区域设置的变化? [英] How to get notified when system locale changes in Android?
本文介绍了如何得到通知在Android中,当系统区域设置的变化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我经常通过电话的区域设置为服务器URL的一部分。
I'm regularly passing phone's locale as part of URL to the server.
private static String getLocaleStr() {
Locale locale = Locale.getDefault();
return locale.getLanguage() + locale.getCountry();
}
我不想回忆 getLocalStr()
每次我生成一个URL的时间。有没有得到通知系统区域设置更改时的方式?
I don't want to recall getLocalStr()
every time I generate a URL. Is there a way to get notified when system locale changes?
推荐答案
这是意图为这个广播:
<一个href=\"http://developer.android.com/reference/android/content/Intent.html#ACTION_LOCALE_CHANGED\">http://developer.android.com/reference/android/content/Intent.html#ACTION_LOCALE_CHANGED
这篇关于如何得到通知在Android中,当系统区域设置的变化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文