4

Is there something equivalent to the UIImage iOS class in Android? I need an object that can take in a byte array and store it as an image in memory so I can use it later.

Robert Harvey
  • 178,213
  • 47
  • 333
  • 501
rplankenhorn
  • 2,075
  • 2
  • 22
  • 32
  • Gotta be [ImageView](http://developer.android.com/reference/android/widget/ImageView.html), right? [setImageBitMap](http://developer.android.com/reference/android/widget/ImageView.html#setImageBitmap(android.graphics.Bitmap)) – Robert Harvey May 13 '13 at 17:33

3 Answers3

1

You can convert bitmap to byte array and store where you want. Use like that

Bitmap bmp = intent.getExtras().get("data");

ByteArrayOutputStream stream = new ByteArrayOutputStream();

bmp.compress(Bitmap.CompressFormat.PNG, 100, stream);

byte[] byteArray = stream.toByteArray();

Sunil Kumar
  • 7,086
  • 4
  • 32
  • 50
0

you could try using Bitmap and BitmapFactory Ref: http://developer.android.com/reference/android/graphics/Bitmap.html

vasanth
  • 715
  • 10
  • 23
0

I found a different article that answers my question:

How to convert byte array to Bitmap

I can use the Bitmap object and create them using BitmapFactory.

Community
  • 1
  • 1
rplankenhorn
  • 2,075
  • 2
  • 22
  • 32