Android java Handler sendMessage使用Parcelable传递实例化对象,我这里传递Bitmap 图片数据-CSDN博客
阿里云国内75折 回扣 微信号:monov8 |
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6 |
一、Bundle给我们提供了一个putParcelable(key,value)的方法。专门用于传递实例化对象。
二、我这里传递Bitmap 图片数据实际使用可以成功传统图像数据。
发送
Bundle bundle = new Bundle();
bundle.putParcelable("bitmap",bitmap);
msg.setData(bundle);
mHandler.sendMessage(msg);
接收
Bitmap bitmap = msg.getData().getParcelable("bitmap");
三、参考文章
android message 传递bundle - 代码先锋网