How to close an android application?

后端 未结 6 821
遥遥无期
遥遥无期 2020-12-06 01:35

There are many question regarding this topic but there is no clear answer. Although android\'s memory management is very solid, so many people believe that we shouldn\'t kil

6条回答
  •  情话喂你
    2020-12-06 01:58

    I found my solution. Use this to close an application

    Intent homeIntent = new Intent(Intent.ACTION_MAIN);
    homeIntent.addCategory( Intent.CATEGORY_HOME );
    homeIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    startActivity(homeIntent);
    

提交回复
热议问题