如何从一个活动位图传递到另一 [英] How to pass bitmap from one activity to another

查看:118
本文介绍了如何从一个活动位图传递到另一的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有位图ActivityA我想从这里通过位图ActivityB,我用Google搜索了这一点。当我使用这个

i have bitmap in ActivityA i want to pass the bitmap from here to ActivityB, i googled for this. when i use this

Intent intent = new Intent(this, NewActivity.class);
intent.putExtra("BitmapImage", bitmap);

获取

Bitmap bitmap = (Bitmap) intent.getParcelableExtra("BitmapImage");

我收到此错误的!失败粘结剂交易!。 我怎样才能解决这个问题。

i am getting this error !!! FAILED BINDER TRANSACTION !!! . how can i solve this problem.

推荐答案

您可以简单地命名你位图静态第一位。

You can simply name you Bitmap as static first.

然后创建一个类似的方法

then create a method like

public static Bitmap getBitmap(){
return bitmap;
}

,那么你可以简单地从其他活动的呼吁,

then you can simply call from other activities,

bitmapwantedclass.getBitmap();

希望它可以帮助

Hope it helps

这篇关于如何从一个活动位图传递到另一的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆