When are you calling the code to recycle? If I had to guess it looks like you are doing it before the image is used by the canvas.
The onDestroy is called when the app is cleaned up, so that isn't very useful in this case. From the snippet you have provided it isn't very obvious why you would run into a problem. Are you during references to the bitmap? On Oct 14, 2010 8:11 AM, "Lisa" <lpk...@gmail.com> wrote: > please help me. 。゜゜(´□`。)°゜。 > > I am using android 1.6. > > my code to release a bitmap looks like this: > > if (imageBG != null) { > imageBG.recycle(); > imageBG = null; > > } > > but when I do get to the following error: (u_u,) > > 10-14 11:36:52.069: ERROR/AndroidRuntime(618): Uncaught handler: > thread main exiting due to uncaught exception > 10-14 11:36:52.089: ERROR/AndroidRuntime(618): > java.lang.RuntimeException: Canvas: trying to use a recycled bitmap > android.graphics.bit...@437d8e60 > 10-14 11:36:52.089: ERROR/AndroidRuntime(618): at > android.graphics.Canvas.throwIfRecycled(Canvas.java:955) > 10-14 11:36:52.089: ERROR/AndroidRuntime(618): at > android.graphics.Canvas.drawBitmap(Canvas.java:1044) > 10-14 11:36:52.089: ERROR/AndroidRuntime(618): at > android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:291) > ... > > What should I do? ~(・・?) > I do not know how to release memory. 。゜゜(´□`。)°゜。 > > please, help me.┌(_ _)┐ > > Thanks a lot for all your replies. m(_ _)m > > -- > 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<android-developers%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- 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