繁体   English   中英

为什么Android Device Monitor不显示我的线程?

[英]Why Android Device Monitor doesn't show my threads?

当我启动使用多个线程的Android应用程序(它们可以正常工作并运行)时,我在Android Device Monitor中看到的只有11个线程,对于我的应用程序,该线程永远不会少,也不会更多。

它们被命名为main,GC,Signal Catcher,JDWP,Compiler,ReferenceQueueDaemon,FinalizerDaemon,FinalizerWatchdogDaemon,Binder_1,Binder_2,Thread-6542。

该列表中应该有数十个我自己的线程。 似乎我的线程只是打包在单个线程上,每个线程都会运行一段时间并重复执行。

    for (Move m : moves) {
        MinMaxThread thread = new MinMaxThread(m, values, color);
        thread.run();
        threads.add(thread);
    }
    for (Thread t : threads) {
        boolean working = true;
        while (working) {
            try {
                t.join();
                working = false;
            } catch (InterruptedException e) {
            }
        }
    }

编辑:事实出于某种原因,我使用了run()而不是start()。

使用start()方法启动线程,而不是直接调用run()

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM