On Thu, Aug 2, 2012 at 10:07 PM, RichardC
<[email protected]> wrote:
> Your renderer thread should be using a WeakReference to your context,
> getting it and testing it for not null every time it wants to use it.  If
> you get a null back, then bail out as the Activity has gone away.

Hm... that sounds too invasive to be honest.  The Context users are
low-level loaders who don't know how to bail out properly.  That would
probably mean a lot of exception throwing, plus it would leave data in
an undefined state if bailing out happens (not sure if this would be a
huge problem in this particular situation but it could well be).

Come to think of it, I guess I'll have to implement a suspend/resume
style signalling between the two threads in onPause() and
onDrawFrame().  Technically just a couple of lines of code, but I
don't like having that kind of code if I can avoid it, it tends to be
subtle and easy to mess up inadvertently in the future.  It would be
good if this was encapsulated in a platform API.

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