How to get the running threads in Android process?
Is there a way to know all the threads that开发者_Python百科 are currently running in background inside of an Android application??
Thanks!!
The user interface by default runs in a single thread!
Map<Thread, StackTraceElement[]> myMap = Thread.getAllStackTraces();
This map also contains system threads running in this application like garbage collection.
An Android application, by default, runs in a single thread. This is why it is important to spawn off threads to do significant work in your application so that the main thread can continue to respond to the OS and GUI input, avoiding the "Application Not Responding" dialog.
This information can be found in the Android development guide here.
精彩评论