超一流的android生命周期

编程入门 行业动态 更新时间:2024-10-25 08:24:17
本文介绍了超一流的android生命周期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

为什么你需要调用父类在android的生命周期?例如,在的onCreate需要调用super.onCreate,或的onDestroy super.onDestroy

Why is it that you need to call the super class in the android lifecycle? For example, in onCreate you need to call super.onCreate, or onDestroy super.onDestroy.

推荐答案

这可以确保在整个类层次结构的任何有关生命周期管理code被调用。

It makes sure that any relevant lifecycle management code across the full class hierarchy gets invoked.

如果你有 MyBaseActivity 扩展活动和 MySpecificActivity 扩展 MyBaseActivity ,通过调用在每个级别的手段生命周期方法在超 MyBaseActivity 将仍然能够响应生命周期事件。

If you have MyBaseActivity that extends Activity, and MySpecificActivity that extends MyBaseActivity, calling through to the lifecycle methods in the superclass at each level means MyBaseActivity will still be able to respond to lifecycle events.

更多推荐

超一流的android生命周期

本文发布于:2023-11-06 22:35:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1564858.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:生命周期   超一流   android

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!