OutOfMemoryError: bitmap size exceeds VM budget :- Android

Posted by Shalini Singh on Stack Overflow See other posts from Stack Overflow or by Shalini Singh
Published on 2010-05-28T09:49:03Z Indexed on 2010/05/28 9:51 UTC
Read the original article Hit count: 1108

Filed under:

Hi! i am downloading images from Url and displaying them,,, at the downloading time it is giving "out of memory error : bitmap size exceeds VM budget" i am using drawable ... code is giving bellow:

HttpClient httpclient= new DefaultHttpClient();
HttpResponse response=(HttpResponse)httpclient.execute(httpRequest);
 HttpEntity entity= response.getEntity();
BufferedHttpEntity bufHttpEntity=new BufferedHttpEntity(entity);
InputStream instream = bufHttpEntity.getContent();

Bitmap bm = BitmapFactory.decodeStream(instream);`
 Bitmap useThisBitmap = Bitmap.createScaledBitmap(bm,bm.getWidth(),bm.getHeight(), true);
bm.recycle();
BitmapDrawable bt= new BitmapDrawable(useThisBitmap);
System.gc();

Error: 05-28 14:55:47.251: ERROR/AndroidRuntime(4188): java.lang.OutOfMemoryError: bitmap size exceeds VM budget

Please help me,,,,

© Stack Overflow or respective owner

Related posts about android