show Thread Names - Android java.lang

Android examples for java.lang:Thread

Description

show Thread Names

Demo Code


//package com.java2s;
import java.util.Set;
import android.util.Log;

public class Main {
    public static void showThreadNames() {
        Set<Thread> threadSet = Thread.getAllStackTraces().keySet();
        Thread[] threadArray = threadSet.toArray(new Thread[threadSet
                .size()]);/*from  w  ww  .jav a 2s  .co  m*/
        for (Thread t : threadArray) {
            Log.d("THREAD", "Thread: " + t.getName());
        }
    }
}

Related Tutorials