Is ondestroy not always called?

前端 未结 3 1404
借酒劲吻你
借酒劲吻你 2020-11-27 07:53

I have put some cache cleaning code in onDestroy of my activity but most of the time the code is not executed unless I explicitly finish the activity via

3条回答
  •  暖寄归人
    2020-11-27 08:28

    try to use onstop

    like this

    @Override
        protected void onStop() {
            super.onStop();
           //write your code here
        }
    

提交回复
热议问题