【发布时间】:2018-08-22 05:44:29
【问题描述】:
我的 MainActivity 里面有 BottomNavigation,它使用以下方法加载片段
private boolean loadFragment(Fragment fragment) {
//switching fragment
if (fragment != null) {
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.fragment_container, fragment)
.commit();
return true;
}
return false;
}
当我在它们之间快速切换时,我的应用程序会在不同的地方崩溃,但是当我一个接一个地慢慢进行时,一切正常
这就是我的应用程序结构的样子
我正在使用Reteofit 进行 API 调用
我已经试过setuserVisibleHint 也检查一下我的视图rootView是否被创建
【问题讨论】:
-
分享你的 logcat 报告
-
我可以共享 logcat 但错误在片段上不一致,主要是 NPE
-
在 logcat 中看到崩溃是查找错误的重要部分。并帮助您。
标签: android fragment bottomnavigationview