How can I find out what thread is using CPU in my android application
android, cpu
Solution
Yes and it's even free. it is called DDMS and is part of the ADT plugin for Eclipse.
Connect your device via USB, start off your app, and then open DDMS view and you will be able quickly find your CPU intensive thread.
Note that it's a good practice to give human readable names to the threads spawned by your program. Your users will never these names, but it will make thread debugging/profiling simpler:
Thread.currentThread().setName("DB-Access-Thread");
Problem
If I run top on my dev android device I can see that when my app in is the background it uses .6% cpu, if I bring it to the foreground it uses 5-6% of the cpu. The problem is, it's not doing anything. There's no services running, there's no background threads, it's just waiting for the user to click a button. Is there a way in adt or via some other tool to find out which thread is eating the cpu so I can get an idea where to start looking for problems?