Hi there,
I'm building a LiveWallpaper which i thought was ready to publish
until a ran it on a galaxy S (my phone is a HTC MAGIC :S)

I'm getting out of memory exception when I scale the images.

I know this question has been already posted before and i've red most
of the posts and its answers,  I  understand that my problem lays in
the fact that android only allows 16 MB of memory for each process,
and i'm loading more than that:

I would like ask  the help and ideias on a new approach to the
problem:

My LiveWallaper loads  3 bitmaps (PNGs) the ideias is to overlay them
i order to get a parallax efect:

bitmap 1 -> 403KB 1600x800
bitmap 2 -> 73KB 1600x480
bitmap 3 -> 73KB 1600x480

(The reason why I use wide bitmap is to achieve a good parallax
effect  and also not loose image quality on the scaling)

To avoid memory leaks and ending up with lots of bitmaps that aren't
collected by the GC, I a have a bitmapHolder class that holds the
bitmaps scaled, then the sprites from the wallpaper just fetch which
bitmap they need to paint them on the canvas.


When scaling for a GALAXY S (800x480) means my images go to:

bitmap 1 -> 403KB 1600x800
bitmap 2 -> 73KB 2600x800
bitmap 3 -> 73KB 2600x800

Which means that  uncompressed they have around 6 MB each, totaling
18MB :S

This isn't a memory leak I'm getting the exception  in the first line
of code when i call the bitmapHolder  to load resources.

I'm a bit lost here need some expert opinion

thanks in advanced,

-- 
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