区别 getChildFragmentManager getSupportFragmentManager
来源:互联网 发布:网络销售红酒好做吗 编辑:程序博客网 时间:2024/04/30 19:51
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 空白页的情况。。。。
【Android】java.lang.IllegalStateException: Recursive entry to executePendingTransactions 错误
所以 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详解
- Android OpenGL ES 开发教程(12):绘制一个20面体
- Android开发网站访问不了问题
- javascript基础编程の变量、对象、数据类型及函数
- java 文件读取
- [小工具] 五笔输入法
- 区别 getChildFragmentManager getSupportFragmentManager
- curl命令
- 十进制转换为二进制、八进制、十六进制程序
- js中substring和substr的用法
- JS 入门1
- 【PHP学习第一篇】PHP+nginx+windows初尝试
- Codeforces Round #260 (Div. 2) D SG函数(制胜 + 制败)
- 浅析mysql内存参数之-- binlog_cache_size
- InstallShield内部库函数全集