你可以这样
//Give you set of ThreadsSet<Thread> setOfThread = Thread.getAllStackTraces().keySet();//Iterate over set to find yoursfor(Thread thread : setOfThread){ if(thread.getId()==yourThread.getId()){ thread.interrupt(); }}
你可以这样
//Give you set of ThreadsSet<Thread> setOfThread = Thread.getAllStackTraces().keySet();//Iterate over set to find yoursfor(Thread thread : setOfThread){ if(thread.getId()==yourThread.getId()){ thread.interrupt(); }}