Android如何接收locale改变的消息
2011-02-15 11:11
501 查看
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过滤器,声明可以接收广播消息,
如下,
<intent-filter>
<action android:name="android.intent.action.LOCALE_CHANGED" />
</intent-filter>
这样当locale改变之后,onReceive会接收到locale改变的消息,执行相应的处理
转自 http://blog.csdn.net/liushaogeng/archive/2010/09/28/5912560.aspx
具体实现在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过滤器,声明可以接收广播消息,
如下,
<intent-filter>
<action android:name="android.intent.action.LOCALE_CHANGED" />
</intent-filter>
这样当locale改变之后,onReceive会接收到locale改变的消息,执行相应的处理
转自 http://blog.csdn.net/liushaogeng/archive/2010/09/28/5912560.aspx
相关文章推荐
- android如何推送一个消息给特定的手机,别的手机接收不到
- android smack源码分析——接收消息以及如何解析消息
- Android演示如何接收广播消息
- android smack源码分析——接收消息以及如何解析消息【3】
- android 如何屏蔽接收来自某些信道的小区广播消息
- android smack源码分析——接收消息以及如何解析消息
- android smack源码分析——接收消息以及如何解析消息
- android smack源码分析——接收消息以及如何解析消息
- android如何改变系统默认横竖屏方向
- Android消息推送接收后,通知栏的显示
- 如何在VB例程中接收自定义消息
- androoid framework学习之 - RILd启动过程和如何接收framwork层的消息流程
- 如何在Qt中处理(接收/发送)MFC或Windows消息(message)
- Android OnTouchListener 导致 OnClickListener 接收不到消息 无反应
- ActiveMQ中消费者是如何接收消息的(二)
- android端实现mqtt消息接收
- android 中如何监听耳机键消息
- android Fragment接收Jpush推送消息
- android 蓝牙编程重点---如何发送和接收16进制数据
- c# 中如何定义和接收消息