UI thread is getting stuck on 2.3 devices

408 views Asked by At

I have a pretty big app that I am working on. Sometimes when I start it on 2.3 devices, the UI thread gets somehow stuck. I don't think it is one of my own tasks, but I just cannot figure out what it is. Is there any way that I can figure out what exact task is currently running in the UI Thread?

More info: I'm running a Runnable on a Handler that uses the main Looper at some point, but run() never gets executed in those cases. I also get an ANR when I touch the screen then. I assume it must be related to the memory in some way because when I remove one of the background images, it feels like it gets stuck less. I do not get an OOM exception though.

Edit

I enabled logging for the main Looper. The last task that gets dispatched has what=1004. This is definitely not from me.

Looper: >>>>> Dispatching to Handler{406cbec0} null: 1004
1

There are 1 answers

1
Display name On

Sorry for posting as answer (Not enough points for comment) but I believe naming your AsyncTasks and Threads and then using DDMS or any other Android profiling tool could possibly help solve your problem.

By figuring out the most performance/time consuming methods and threads, or possibly something that is overloading the memory (Examine the heap using DDMS).

Take a look at the following links:

http://developer.android.com/tools/debugging/ddms.html http://developer.android.com/tools/debugging/debugging-tracing.html

Sorry if this wasn't any help.