Reputation: 13529
Is there a way to know all the threads that are currently running in background inside of an Android application??
Thanks!!
Upvotes: 4
Views: 3937
Reputation: 966
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.
Upvotes: 6
Reputation: 10487
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.
Upvotes: -2