Use a bitmap because it contains an image pixel that will be useful for future use if you want to display that image.
e.g. ---->
Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.icon); ImageView iv = (ImageView) findViewById(R.id.imageView1); iv.setImageBitmap(bm);
- ----------------------------------- EDITED PART ------ ------ --------------------------------
if you want to send an image from one place to another (one device to another), you must convert it to an array of bytes, for example: --->
Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.icon); ByteArrayOutputStream baos = new ByteArrayOutputStream(); bm.compress(Bitmap.Compress.JPEG, 100, baos); byte[] b = baos.toByteArray();
and then send it to another device.
source share