I am trying to get inputstream by passing url of the image, but when i have more images requested it says out of memory and after sometimes the server restarts.
public InputStream getBitmap(String imagePath, int THUMBSIZE ){
Bitmap ThumbImage = ThumbnailUtils.extractThumbnail(BitmapFactory.decodeFile(imagePath), THUMBSIZE, THUMBSIZE);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
ThumbImage.compress(CompressFormat.PNG, 0 , bos);
ThumbImage.recycle();
byte[] bitmapdata = bos.toByteArray();
InputStream bs = new ByteArrayInputStream(bitmapdata);
return bs;
}
this is where i use above method, why it is giving out of memory error ?
String query_file = parameters.get("fname");
String Mime = get_mime(query_file);
String original_path = root.getAbsolutePath()+query_file;
InputStream br = this.getBitmap(original_path, 96);