John, I was commenting on the exception you mentioned in your original
email:

   FATAL EXCEPTION: main
E/AndroidRuntime(  405): java.lang.RuntimeException: Canvas: trying to
use a recycled bitmap android.graphics.bit...@44f4c150

Running out of memory, which is what is mentioned in the bug you referred
to, is a different issue. Having the PNGs in the right density folders does
indeed help because you avoid having the system scale them and increase
their size in memory. However, the exception message that mentions a
recycled bitmap is caused by trying to draw a bitmap on which you called
recycle() (I was indeed a bit hasty in my email, it's not caused by calling
recycle() twice.) The problem you were running into is that drawables share
the same bitmap when loaded from resources. If you recycle that bitmap, it
will be reused by the system next time you use a drawable that comes from
the same resource.

On Fri, Jan 7, 2011 at 11:36 AM, Joe McCann <[email protected]> wrote:

> BTW, your assessment was incorrect.  It had to do with the placement
> of the png in their respective folders (h/m/l-dpi).  Nothing to do
> with my "code".
>
> On Jan 7, 12:16 pm, Romain Guy <[email protected]> wrote:
> > This error message is usually not related to the GC. This message is
> logged
> > when recycle() is called twice on the same bitmap. Considering you are
> doing
> > your own bitmap management and calling recycle yourself in BaseForm I
> would
> > suspect a bug in your code.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On Fri, Jan 7, 2011 at 9:44 AM, Mark Murphy <[email protected]>
> wrote:
> > > On Fri, Jan 7, 2011 at 12:36 PM, Joe McCann <[email protected]>
> > > wrote:
> > > > Also, it appears this is a bug that is "declined" by the Android
> > > > team.  "Use less memory in your app" was the original solution
> > > > suggested by Romain Guy.
> >
> > > >http://code.google.com/p/android/issues/detail?id=8488
> >
> > > The issue you list here would appear to have nothing to do with your
> > > problem, considering that your error ("trying to use a recycled
> > > bitmap") appears nowhere in that issue.
> >
> > > --
> > > Mark Murphy (a Commons Guy)
> > >http://commonsware.com|http://github.com/commonsguy
> > >http://commonsware.com/blog|http://twitter.com/commonsguy
> >
> > > Warescription: Three Android Books, Plus Updates, One Low Price!
> >
> > > --
> > > 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]<android-developers%[email protected]><android-developers%2Bunsubs
> [email protected]>
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en
> >
> > --
> > Romain Guy
> > Android framework engineer
> > [email protected]
> >
> > Note: please don't send private questions to me, as I don't have time to
> > provide private support.  All such questions should be posted on public
> > forums, where I and others can see and answer them
>
> --
> 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]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Romain Guy
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them

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