Intent传递图片

ActivityA:
 
  
Intent intent = new Intent(this, ActivityB.class);
ByteArrayOutputStream baos=new ByteArrayOutputStream();
list.get(position).getIcon().compress(Bitmap.CompressFormat.PNG, 100, baos);
byte [] bitmapByte =baos.toByteArray();
intent.putExtra("imgbitmap", bitmapByte);

startActivity(intent);

ActivityB:

 
  
byte [] bis=in.getByteArrayExtra("imgbitmap");
 bitmap= BitmapFactory.decodeByteArray(bis, 0, bis.length);
 
  
imgview.setImageBitmap(bitmap);


你可能感兴趣的:(技术问题以及解决方法,Android)