Reputation: 186
I am trying to get the images in ListView ,in such way i will recieve the images in String .But if i am using low resolution image there is no problem but i have to get high resolution image i get Out of memory on a 15095824-byte allocation
Here is my android code:
if(image[position]!=null) {
byte[] imageAsBytes = Base64.decode(image[position].getBytes(), Base64.DEFAULT);
assert hirerPicLocal != null;
hirerPicLocal.setImageBitmap(BitmapFactory.decodeByteArray(imageAsBytes,0, imageAsBytes.length));
}
Upvotes: 0
Views: 359
Reputation: 479
Your image is too big! You need to scale it.
final BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 2; // your "scale"
Bitmap bitmap = BitmapFactory.decodeByteArray(imageAsBytes, 0, imageAsBytes.length, options);
For more information see documentation: Loading Large Bitmaps
Upvotes: 1