How to kill my own Activity - the hard way

后端 未结 8 585
灰色年华
灰色年华 2021-01-31 10:59

So I have my Activity, and on pressing a \"Quit\" button I call Activity.finish(). This effectively closes my application.

The problem: The Dalvik-process of my applicat

8条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-31 11:34

    By killing the process you can stop the application completely.from the last screen on back button press you can kill the process by :

    public void onBackPressed() {   
            super.onBackPressed();   
            int pid = android.os.Process.myPid();
            android.os.Process.killProcess(pid);    }
    

提交回复
热议问题