Sending Activity to background without finishing

前端 未结 5 972
臣服心动
臣服心动 2020-12-05 14:53

How can I make an activity go to background without calling its finish() method and return to the Parent activity that started this? I tried so much but I could

5条回答
  •  一向
    一向 (楼主)
    2020-12-05 15:32

    Simply

    protected void minimizeApp() { Intent startMain = new Intent(Intent.ACTION_MAIN); startMain.addCategory(Intent.CATEGORY_HOME); startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(startMain); }

提交回复
热议问题