开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜