How to quit android application programmatically

前端 未结 30 2741
迷失自我
迷失自我 2020-11-22 03:06

I Found some codes for quit an Android application programatically. By calling any one of the following code in onDestroy() will it quit application entirely?

30条回答
  •  梦谈多话
    2020-11-22 03:09

    The correct and exact solution to quit the app on button click is using the below code:

    //On Button Back pressed event

    public void onBackPressed()
    { 
       moveTaskToBack(true);
       finish();
    }
    

提交回复
热议问题