2016-06-29 33 views
4

在一個活動中,我分離了幾個單獨的線程。後來,在其中一個子線程上,我撥打以下電話:Android UI線程中遇到了什麼

((Activity) context).runOnUiThread(new Runnable() { 
    public void run() { 
     String message = "Exception thrown: Developer mode was enabled while " + 
      "trying to access the app."; 
     throw new RuntimeException(message); 
    } 
}); 

現在,還有什麼會與UI線程一起被殺死?其他線程也會死掉嗎?當應用程序崩潰時,它仍然在後臺運行(我認爲)

回答

1

我認爲與該進程相關的所有線程都將被終止(在單個進程模型場景中)。您可以從之前在命令行中運行

ps -t | grep [your-app-user-id] 

驗證和RuntimeException

後獲取應用程序的用戶ID:

ps | grep [your-package-name]