Android: OnDestroy isn't called when I close the app from the recent apps button

前端 未结 4 899
长情又很酷
长情又很酷 2020-12-29 04:30

When we press this button

We see the apps which we didn\'t close, like this

But when we want to close an app from this screen (below image), the method onD

4条回答
  •  自闭症患者
    2020-12-29 05:03

    Your problem is that onDestroy is only called in aService. In an Activity the called method is onPause() Put simply in your Activity the field:

    @Override
    public void onPause()
    {
    //Put your Code here
    }
    

提交回复
热议问题