1

I am facing problem while loading image from url. The image url contains HD image and it sets to ImageView. I am getting below error.

    java.lang.OutofMemoryError: bitmap size exceeds VM budget.

The application has many HD images to display. I also need to display HD images from local resource. Can anybody help me to resolve it?

Thanks.

Pranav
  • 11
  • 1
  • [what have you tried?](http://mattgemmell.com/2008/12/08/what-have-you-tried/) – Renard Apr 10 '12 at 12:56
  • @Pranav just google "android OutOfMemoryError" & u get the solution right there.For now try http://stackoverflow.com/a/4134307/437703 or http://stackoverflow.com/a/4657285/437703 – 100rabh Apr 10 '12 at 12:57
  • Thanks for your quick reply. I have already tried with above links but sometime it gets force close. I get the image url from the web service using JSON but the actual image size is more than 5 MB. So, still it gets force close sometimes. – Pranav Apr 10 '12 at 13:03

2 Answers2

0

You will have to scale your image before setting it to image view. Follow these links to avoid your error:

OutOfMemory error while joining large images

Strange out of memory issue while loading an image to a Bitmap object

Out of Memory Error while using many bitmaps

Community
  • 1
  • 1
AndroDev
  • 3,236
  • 8
  • 35
  • 49
0

Android apps has a memory limit. Try to optimize the images.

Caner
  • 57,267
  • 35
  • 174
  • 180