Try this: Before setting it to null, call mpBitmap.recycle().

But be sure, though, that the reference held by mpBitmap is not held
somewhere else in your program by another heap variable, cache or an
active View.

On Jun 23, 9:07 am, hamlatzis <i.hamlat...@gmail.com> wrote:
> My application crashes after I try to use the static Bitmap
> createBitmap method to get a mutable bitmap in order to fill it later
> with data.
>
> If I only create one 1024x1024 the application works just fine, but
> when I try to load the same image more than once (first making my
> object null in each round) my application crashes on my third or
> fourth try.
>
> eg
> Bitmap mpBitmap = null;
>
> void CreateBitmap(int nWidth, int nHeight)
> {
>      if ( mpBitmap != null )
>           mpBitmap = null;
>      mpBitmap = Bitmap.createBitmap(nWidth, nHeight,
> Bitmap.Config.ARGB_8888);
>
> }
>
> I get the same result if I create a smaller image but then I need more
> runs before the crash. In all cases my application works just fine if
> I only create the image (even 1024x1024) once, then exit my
> application and run it again.
>
> If there is a need for "crash dump" I can provide one.
>
> Any help will be appreciated.
>
> Thanks,
>
> Iosif
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to