本文介绍了android Fragment中的onAttach()和iwego()有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
谁能告诉我在Android Fragment中onAttach()和i☎联系人的使用有何不同?
Can anyone tell me what are the different of use of onAttach() and isAdded in Android Fragment?
在创建新片段的onAttach()方法时,会创建默认片段.
When create a new fragment onAttach() method creating default.
我检查了这个问题,询问有关!onDetech()和iwego()的问题,也是那里的一个答案,但我不清楚.谢谢
I checked this question, the question is asked about !onDetech() and isAdded() , also one answer there, but I am not clear with that.. Thanks
推荐答案
只需阅读javadocs即可回答:
This could be answered simply reading javadocs:
/**
* Called when a fragment is first attached to its context.
* {@link #onCreate(Bundle)} will be called after this.
*/
public void onAttach(Context context)
和
/**
* Return true if the fragment is currently added to its activity.
*/
final public boolean isAdded()
这篇关于android Fragment中的onAttach()和iwego()有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!