在Android中使用onDestroy() [英] Use of onDestroy( ) in android

查看:88
本文介绍了在Android中使用onDestroy()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果Java提供了垃圾回收,那么Activity LIfecycle中的onDestroy()有什么需求?

If java provides Garbage Collection, then what is the need of onDestroy() in Activity LIfecycle ?

推荐答案

onDestroy:在活动销毁之前收到的最后一个呼叫.发生这种情况的原因可能是活动正在结束(有人在其上称为finish()),也可能是因为系统暂时销毁了该活动实例以节省空间.

onDestroy: The final call you receive before your activity is destroyed. This can happen either because the activity is finishing (someone called finish() on it), or because the system is temporarily destroying this instance of the activity to save space.

这里是一个例子……

 public void onDestroy() {
              
   super.onDestroy();

 }

这篇关于在Android中使用onDestroy()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆