区别 getChildFragmentManager getSupportFragmentManager
来源:互联网 发布:java ftp上传文件夹 编辑:程序博客网 时间:2024/04/30 23:42
The definition of getChildFragmentManager()
is:
Return a private FragmentManager for placing and managing Fragments inside of this Fragment.
Meanwhile the definition of getFragmentManager()
(or in this case getSupportFragmentManager()
) is:
Return the FragmentManager for interacting with fragments associated with this fragment's activity.
Basically, the difference is that Fragment's now have their own internal FragmentManager
that can handle Fragments. The child FragmentManager is the one that handles Fragments contained within only the Fragment that it was added to. The other FragmentManager is contained within the entire Activity
.
In this case, what I'm guessing is you've added the Fragments to the Activity's FragmentManager. You get the child FragmentManager which doesn't contain what you are looking for. Thus you get the exception because it can't find the Fragment with the given ID because it's in a different FragmentManager.
=============================================
mSectionsPagerAdapter = new SectionsPagerAdapter(getActivity().getSupportFragmentManager());
在Fragment里面嵌套Fragment 的话,不要用上面的那句。。。会在ViewPager中出现。有些Fragment 不会加载的情况。。。既ViewPager 加载 Fragment 空白页的情况。。。。
所以 Fragment里面嵌套Fragment 的话:一定要用getChildFragmentManager();
mSectionsPagerAdapter = new SectionsPagerAdapter(getChildFragmentManager());
- 区别 getChildFragmentManager getSupportFragmentManager
- 区别 getChildFragmentManager getSupportFragmentManager
- 区别 getChildFragmentManager getSupportFragmentManager
- 区别getFragmentManager、getSupportFragmentManager和getChildFragmentManager
- 区别getFragmentManager、getSupportFragmentManager和getChildFragmentManager
- getChildFragmentManager和getSupportFragmentManager的区别
- getChildFragmentManager()、 getFragmentManager()、getSupportFragmentManager()的区别
- getFragmentManager 、getSupportFragmentManager 与getChildFragmentManager三者之间的区别
- getSupportFragmentManager()和getChildFragmentManager()
- android getFragmentManager、getSupportFragmentManager、getChildFragmentManager理解
- 关于getChildFragmentManager()、 getFragmentManager()、getSupportFragmentManager()的使用
- 关于getChildFragmentManager()、 getFragmentManager()、getSupportFragmentManager()的使用
- 关于getChildFragmentManager()、 getFragmentManager()、getSupportFragmentManager()的使用
- 关于getChildFragmentManager()、 getFragmentManager()、getSupportFragmentManager()的使用
- getFragmentManager与getChildFragmentManager 区别
- getFragmentManager()和getSupportFragmentManager()区别
- getChildFragmentManager
- 安卓开发之详解getChildFragmentManager和getsupportFragmentManager和getFragmentManager详解
- 第十一周项目2 职员有薪水了
- Local declaration of 'XXX' hides instance variable
- 【原理思路】B-树原理
- GCC警告提示错误“cc1:all warnings being treated as errors”
- 安卓Socket网络编程技巧总结
- 区别 getChildFragmentManager getSupportFragmentManager
- 基于SAML的单点登录介绍
- 基本IO函数的使用(open,write,read)
- 修炼 读书笔记 一
- 两种结果竟然不一样
- Linux学习篇-SVN命令详解
- 拂袖起舞于梦中徘徊
- SqlDataAdapter.TableMappings 的用法
- C语言中system和exec的本质区别