exit entire app at once

梦想的初衷 提交于 2019-11-30 15:39:37

Not recommened but still you can use this. Better go with this solution in case you need to quit the app.

According to me the best solution is finish every activity in your app like below.

step1) maintain a static variable in mainactivity say.

  public static boolean isQuit = false;

step2) on click event of an button make this variable to true.

   mainactivity.isQuit = true;
   finish();

step3) And in every activity of your application have onrestart method as below..

  @Override
      protected void onRestart() {
         // TODO Auto-generated method stub
         super.onRestart();
        if(mainactivity.isQuit)
            finish();
    }

u can kill all thread asynctask every running activity with :

System.exit(0);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!