个人代码笔记,非教程
个人代码笔记,非教程
intent.putExtra(EXTRA_MESSAGER,new Messenger(handler));
2. 取
Bundle extras = intent.getExtras();
Messenger mesenger = (Messenger)extras.get(EXTRA_MESSAGER);
Messenger mesenger = (Messenger)extras.get(EXTRA_MESSAGER);
3.发送信息
//创建一条message
Message msg = Message.obtain();
msg.what = DownloadItemPresentationModel.UPDATE_UI;
//存放信息
Bundle bundle = new Bundle();
bundle.putSerializable(DownloadItemPresentationModel.EXTRA_DOWNLOADINFO, downloadInfo);
msg.setData(bundle);
//发送
mesenger.send(msg);
</pre><div></div><div></div><div>4.接收信息</div><div><pre name="code" class="java"> private Handler handler=new Handler()
{
public void handleMessage(Message msg)
{
if (!Thread.currentThread().isInterrupted()) {
Bundle bundle=msg.getData();
switch (msg.what) {
case UPDATE_UI:
//ToDo
default:
break;
}
}
}
};