I have a grid of many products in my app. when the user selects one of the item in the grid, I am starting a new activity as DIALOG box and display the item\'s name,quantity
You can convert your drawable to bitmap then into byte array and pass this byte array with intent.
Drawable d;
Bitmap b= ((BitmapDrawable)d).getBitmap();
int bytes = b.getByteCount();
ByteBuffer buffer = ByteBuffer.allocate(bytes);
b.copyPixelsToBuffer(buffer);
byte[] array = buffer.array();
user this code :
calling activity...
Intent i = new Intent(this, NextActivity.class);
Bitmap b; // your bitmap
ByteArrayOutputStream bs = new ByteArrayOutputStream();
b.compress(Bitmap.CompressFormat.PNG, 50, bs);
i.putExtra("byteArray", bs.toByteArray());
startActivity(i);
...and in your receiving activity
if(getIntent().hasExtra("byteArray")) {
ImageView previewThumbnail = new ImageView(this);
Bitmap b = BitmapFactory.decodeByteArray(
getIntent().getByteArrayExtra("byteArray"),0,getIntent().getByteArrayExtra("byteArray").length);
}