zeeshan wrote:
> Hi Experts,
> 
> I am beating my head against a wall since 3 days trying to resolve out
> of memory exception but still no success.
> here is the line giving me this error
> 
> 
>  image_view.setImageURI(image_uri);
> 
> everytime when i change the orientation or start this activity again,
> it gives me out of memory exception
> 
> VM won't let us allocate 6291456 bytes.
> 
> it seems i am not leting GC to release my memory.
> any solution would be appreciated

Use a different image.

The G1 has a 320x480 pixel display. Your image is consuming ~41 bytes
per pixel...which seems a little high. More likely, it is a much higher
resolution picture than the G1 display can handle.

So, use a different image. Or scale down the one you have before
displaying it (and cache the smaller one to reuse on the rotation):

http://www.anddev.org/resize_and_rotate_image_-_example-t621.html

Also, call recycle() when you are done with the Bitmap, which may help
GC it faster.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android App Developer Training: http://commonsware.com/training.html

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to