我的应用程序中有一个线程正在运行,但是当它完成工作并且我尝试停止它时,线程使应用程序崩溃并重新启动导致崩溃循环,直到我重新打开应用程序 Runnable:
final class TheThread implements Runnable{
public void run(){
if (!thread.isInterrupted()){
//dowork
thread.interrupt();
}
}
}
线程创建:(变量线程在oncreate方法中被安装为常规线程对象)
thread = new Thread(new TheThread());
thread.setPriority(START_STICKY);
thread.start();