活动生命周期方法 [英] Activity Life Cycle methods

查看:109
本文介绍了活动生命周期方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试了解活动的整个生命周期.

因此,我在Google上进行搜索,发现了很多有关活动生命周期的教程,但是在所有教程中,我都没有在生命周期图中找到这些方法:
1. OnContentChanged()
2. OnPostCreate()
3. OnPostResume()
4. OnWindowfocusChanged()
5. OnuserLeaveHint()
6. OnUserInteraction()
7. OnDetachedFromWindow()

我想知道为什么这些方法未包含在android docs的活动生命周期图中.

还有一个问题:
当第一时间创建活动时,系统将在调用第一个方法时调用OnContentChanged()方法作为第一个方法,而当某个活动被杀死时,系统最后一次调用是OnDetachedFromWindow()方法,但是android docs说,Activity的整个生命周期发生在OnCreate()OnDestroy()?

I''m trying to understand An Activity full life-cycle.

So I have searched on Google and found lots of tutorials regarding activity life-cycle, but in all tutorials I have not found these methods in life-cycle diagram:
1. OnContentChanged()
2. OnPostCreate()
3. OnPostResume()
4. OnWindowfocusChanged()
5. OnuserLeaveHint()
6. OnUserInteraction()
7. OnDetachedFromWindow()

I would like to known why these method''s are not included in activity life-cycle diagram on android docs.

One more question:
When an activity is created for the fist time then system calls the OnContentChanged() method as the first method and last call by system is the OnDetachedFromWindow() method when an activity is killed, but android docs says entire lifetime of an Activity happens between OnCreate() and OnDestroy()?

推荐答案

选中此
http://developer.android.com/reference/android/app/Activity.html [ ^ ]
您会发现设备发生某些更改时将调用哪个方法.
check this
http://developer.android.com/reference/android/app/Activity.html[^]
you will find which method will call when some changes happens in device.


这篇关于活动生命周期方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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