错误收集篇
Activity has been destroyed
出现场景: fragment嵌套viewpager的情况下可能出现
解决办法: 将此代码复制到外层fragment中
@Override
public
void onDetach() {
super.onDetach();
try {
Field childFragmentManager = Fragment.class
.getDeclaredField("mChildFragmentManager");
childFragmentManager.setAccessible(true);
childFragmentManager.set(this, null);
} catch (NoSuchFieldException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
}
原理分析 等待大神解
参考链接