I've been fighting for a few weeks trying to build a list selector activity 
that is hanging up with a deadlock.  The list item consists of an image on 
the left and text on the right.  Because the image takes some time to load 
and render, the left area starts with an indeterminate progress bar which 
is replaced by the image when it is available.  The loading and rendering 
of the image is spun out to an asynchronous task.  When that task is 
completed, it posts a request to the UI thread to call 
notifyDataSetChanged().  On the next run through the getView method, the 
progress bar will be hidden and the image will be displayed.

This mostly seems to work, however I have race condition somewhere that 
causes a deadlock.  The first page of list items will render just fine.  As 
I scroll quickly to the bottom of the list, I will see the images slowly 
and correctly fill in until something catches and the UI hangs up. 
 Eventually, I will end up with an ANR.

I've tried all of the usual tricks that I can think of to figure out the 
cause of the deadlock:

* With lots of logging information in my adapter handling, it never *seems* 
to be hung in my code.  It may be, but I'm not seeing it.  If it is in the 
framework, I'm not sure where to look?
* The traces.txt file never contains traces from my application.  Instead, 
I see something like "W/dalvikvm(19144): threadid=4: spin on suspend #1 
threadid=9 (pcf=0)" whether it starts explicitly by SIGQUIT or 
automatically due to ANR.
* If I manage to recreate it under debugger control, I'm unable to break 
the UI thread in the debugger to see what it is waiting on.
* I even tried to use method tracing to see if I could spot anything, but 
unfortunately the race condition doesn't trigger with the extra time spent 
in tracing.

At this point, I've run out of ideas on how to figure out what is going on. 
 Is there something that the kernel could tell me?  Is there any UI-level 
logging that I could enable?  Are there any known framework bugs that I may 
be bumping against?  What other tricks that might help me to figure out 
where and why I'm hanging?

Thanks for any help,
Craig

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