java.lang.IllegalStateException: FragmentManager is already executing transactions 及 SmartTabLayout复用
在复用 SmartTabLayout 时, 出现了标题所示的错误。首先我的场景是Activity下两个fragment :A 和 B,A中使用了SmarttabLayout和viewpager结合, B也同样使用了这个结合, 然后就出现了B中滑动异常或不显示了, 网上的答案有几种情况:
一. viewpager的id不能相同
二. getFragmentManager() 改为 getChildFragmentManager(), 简单点说就是即前者只为activity中表层fragment提供服务, 而后者为fragment中的fragment提供服务。
然而都没有解决我那个情况, 后来慢慢debug, 最终发现将findViewById()前的getActivity()改为getView(), 问题解决了(也需要满足上面两种情况)!
两者区别getView()只提供当前fragment的view, 而getActivity()可以提供整个activity的view。所以建议以后还是用Fragment的getView()来初始化控件吧。
java.lang.IllegalStateException: FragmentManager is already executing transactions 及 SmartTabLayout复用的更多相关文章
- java.lang.IllegalStateException: Not allowed to create transaction on shared EntityManager - use Spring transactions or EJB CMT instead
java.lang.IllegalStateException: Not allowed to create transaction on sharedEntityManager - use Spri ...
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState问题解决
(1)我用的是fragment,在onStop但是没有onDestroy的情况下切换(replace)fragment时报 java.lang.IllegalStateException: Can n ...
- myeclipse 无法启动 java.lang.IllegalStateException: Unable to acquire application service. Ensure that the org.eclipse.core.runtime bundle is resolved and started (see config.ini).
把myeclipse10 按照目录完整拷贝到了另外一台电脑, 另外的目录 原安装目录 D\:\soft\i\myeclipse10 新安装目录 E\:\soft\myeclipse10 双击启动失败, ...
- java.lang.IllegalStateException:Couldn't read row 0, col -1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it.
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxx...}: java.lang.IllegalSta ...
- java.lang.IllegalStateException: getOutputStream() has already been called for this response
ERROR [Engine] StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exceptionjava.lang ...
- 用java实现文件下载,提示java.lang.IllegalStateException: getOutputStream() has already been called for this response
1. 用java实现文件下载,提示java.lang.IllegalStateException: getOutputStream() has already been called for this ...
- eclipse启动报错java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' befo
报错: java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invo ...
- java.lang.IllegalStateException: Couldn't read row 1, col 0 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data fr
Android中操作Sqlite遇到的错误:java.lang.IllegalStateException: Couldn't read row 1, col 0 from CursorWindow. ...
- java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
在ViewPager中,用Fragment显示页面时,报错: java.lang.IllegalStateException: The specified child already has a pa ...
随机推荐
- python(二):可变参数
python中的函数定义: def func(参数, 默认参数, 可变参数) ... 可变参数有两种定义方式: def func(*args): ... 调用方式为func(arg1, arg2, a ...
- DjVu转PDF
作者:马健邮箱:stronghorse_mj@hotmail.com发布:2009.09.22更新:2012.06.11针对PdfToy的新进展,更新了相关内容. 1 引言2 理论3 实现 3. ...
- 事件Event 介绍总结
最近在总结一些基础的东西,主要是学起来很难懂,但是在日常又有可能会经常用到的东西.前面介绍了 C# 的 AutoResetEvent的使用介绍, 这次介绍事件(event). 事件(event),对于 ...
- JetBrains Rider 在 Mac 环境下将 cs 文件生成 exe
因为自己的开发环境是 Mac + Rider 组合,想测试网络编程相关内容.想在Windows 虚拟机上运行一套代码来与Mac 机进行测试,但又不想在虚拟机上安装一套开发环境.最终找到的解决方案是通过 ...
- B:魔兽世界之一:备战
描述 魔兽世界的西面是红魔军的司令部,东面是蓝魔军的司令部.两个司令部之间是依次排列的若干城市. 红司令部,City 1,City 2,……,City n,蓝司令部 两军的司令部都会制造武士.武士一共 ...
- 使用Unity的2D功能开发弹球游戏
https://mp.weixin.qq.com/s/7xjysNDVHe7avF1v2NZWcg
- 为什么选择Angular 2?
没有选择是痛苦的,有太多的选择却更加痛苦.而后者正是目前前端领域的真实写照.新的框架层出不穷:它难吗?它写得快吗?可维护性怎样?运行性能如何?社区如何?前景怎样?好就业吗?好招人吗?组建团队容易吗? ...
- 【51nod1847】奇怪的数学题(Min_25筛+杜教筛)
题面 传送门 题解 这题有毒--不知为啥的错误调了半天-- 令\(f(i)={sgcd(i)}\),那么容易看出\(f(i)\)就是\(i\)的次大质因子,用\(i\)除以它的最小质因子即可计算 于是 ...
- 6、OpenCV Python 图像模糊
__author__ = "WSX" import cv2 as cv import numpy as np #均值模糊 中值模糊 自定义模糊(卷积) #卷积原理 #均值模糊 de ...
- mac 卸载 node
sudo rm -rf /usr/local/{bin/{node,npm},lib/node_modules/npm,lib/node,share/man/*/node.*} 除此之外,还需要检查一 ...