locale信息改变之后,会发广播消息Intent.ACTION_LOCALE_CHANGED,

具体实现在activitymanagerservice.java代码updateConfigurationLocked函数中,

       自己写接收代码如下:

       接收代码:

public class testReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        Log.v("test", "hello");

        if(intent.getAction().compareTo(Intent.ACTION_LOCALE_CHANGED) == 0)
        {
            //处理

            Log.v("test", “received ACTION_LOCALE_CHANGED”);
        }       
    }
}

 

      在AndroidManifest.xml中,添加intent过滤器,声明可以接收广播消息,

      如下,

             

            

      

       这样当locale改变之后,onReceive会接收到locale改变的消息,执行相应的处理

更多相关文章

  1. android 图片处理大全
  2. Eclipse,到了说再见的时候了——Android(安卓)Studio最全解析
  3. android 混淆后的代码还原
  4. windows环境下 android 源码阅读
  5. Android中的HTTP通信
  6. Android(安卓)远程回调
  7. 【代码】android通过criteria选择合适的地理位置服务
  8. Android常用Dialog总结
  9. android 调用系统计算器 实例

随机推荐

  1. 详解android:scaleType属性
  2. Android(安卓)Lottie动画的简单使用
  3. Android知识梳理之自定义View
  4. 【Android】Macbook Pro 10.14(macOS Moja
  5. Cocos2d-x NDK ANDROID VS2010
  6. android如何配置基本环境
  7. Android(安卓)开发简介-系统架构
  8. android和ios之争(开发者该怎样选择?)
  9. Android(安卓)ListView,GridView,ScrollV
  10. Android(安卓)GridView选择样式