[android-developers] Re: Problem with createBitmap method

2009-06-24 Thread hamlatzis

Thank you all for your reply.

I've tried the above solution and it works perfectly. I was reluctant
to do so, since in the documentation it says:


public void recycle ()
Free up the memory associated with this bitmap's pixels, and mark the
bitmap as dead, meaning it will throw an exception if getPixels() or
setPixels() is called, and will draw nothing. This operation cannot be
reversed, so it should only be called if you are sure there are no
further uses for the bitmap. This is an advanced call, and normally
need not be called, since the normal GC process will free up this
memory when there are no more references to this bitmap.


The same applies for calling the GC implicitly. It's something that we
should not have to do.

Anyway, thank you all.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Problem with createBitmap method

2009-06-23 Thread hamlatzis

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_);
}


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