Android Fragment Lifecycle [英] Android Fragment Lifecycle

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

问题描述

您好。我的问题是我不了解Fragments的生命周期。片段首先附加到活动正确吗?但是NewInstance()方法用于在Fragment创建之后和Fragment附件之前命中窗口。有人关心这个冲突吗?

提前致谢。



进一步说明:

我的问题在二读时似乎太模糊了。澄清;在各种来源上,建议使用NewInstance()方法为片段设置参数。 NewInstance()提供片段创建和附件之间的窗口。我的问题是片段的创建是如何在它的附件之前出现的,因为它应该是完全相反的。

Hello. My problem is that i don't understand something about Fragments' lifecycle. Fragments start by getting attached to Activities correct? But NewInstance() method is used to hit the window after Fragment's creation and before Fragment's attachment. Anyone care to enlighten me about this conflict?
Thanks in advance.

Further Explanation:
My question seems too vague in second reading. To clarify; on the various sources, it is advised to use NewInstance() method for a fragment to set arguments. NewInstance() provides the window between fragment's creation and attachment. My question is how fragment's creation comes before its attachment since it is supposed to be the exact opposite.

推荐答案

参见 http://developer.android.com/guide/components/fragments.html [ ^ ]。


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

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