Android之提示错误Can not perform this action after onSaveInstanceState
1 问题
主页面3个Fragment,在第三个Fragment里面开启了Activity之后,然后想跳到第一个Fragment代码如下
/*** 展示Fragment*/private fun showFragment(fragment: Fragment) {if (currentFragment !== fragment) {val transaction: FragmentTransaction = supportFragmentManager.beginTransaction()transaction.hide(currentFragment)currentFragment = fragmentif (!fragment.isAdded) {transaction.add(R.id.mainFrameLayout, fragment).show(fragment).commit()} else {transaction.show(fragment).commit()}}}
然后奔溃错误提示如下
java.lang.IllegalStateException: Can not perform this action after onSaveInstanceStateat androidx.fragment.app.FragmentManagerImpl.checkStateLoss(FragmentManagerImpl.java:1536)at androidx.fragment.app.FragmentManagerImpl.enqueueAction(FragmentManagerImpl.java:1558)
Android之提示错误Can not perform this action after onSaveInstanceState相关推荐
- 解决IllegalStateException: Can not perform this action after onSaveInstanceState
错误信息: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState at andr ...
- Fragment Or DialogFragment Can not perform this action after onSaveInstanceState
转载自Fragment Or DialogFragment Can not perform this action after onSaveInstanceState 表现 可会造成app崩溃掉,具体 ...
- Can not perform this action after onSaveInstanceState和重建Activity时恢复缓存的Fragmen的问题
Fragment 在显示或者隐藏,移除是出现Can not perform this action after onSaveInstanceState #解决办法:onSaveInstanceSta ...
- android数字提示错误,从服务器接收数据时出现Android错误
我正在使用Android中的代码:以编程方式安装.apk. 我试图从服务器接收数据,以更新我的应用程序. 单击按钮后,应用程序崩溃. 如果您知道要解决这些错误很热,请告诉我. 我收到此错误: andr ...
- Android Room提示 错误: Not sure how to convert a Cursor to this method's return type的原因及解决办法
错误: Not sure how to convert a Cursor to this method's return type 最近在使用Room+协程+LiveData查询数据的时候,我的查询方 ...
- 【常见问题】Can not perform this action after onSaveInstanceState
onSaveInstanceState是干什么的呢? 通过该方法保留的实例状态数据,然后借助onCreate(Bundle) or onRestoreInstanceState(Bundle),我们可 ...
- java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
在使用Fragment的过程中,常常会遇到在Activity的onSaveInstanceState方法调用之后,操作commit或者popBackStack而导致的crash. 因为在onSaveI ...
- Caused by:Java.lang.IllegalStateException:Can not perform this action after onSaveInStanceState
出现情况: 是在使用FragmentTransition 的 Commit() 方法添加一个 Fragment的时候出现的. 问题原因: onSaveInstanceState()方法是在该Acti ...
- Android Studio导入别人的module提示错误Plugin with id ‘com.jfrog.bintray‘ not found.
1 问题 Android Studio导入别人的module提示错误如下 Plugin with id 'com.jfrog.bintray' not found. Plugin with id 'c ...
最新文章
- 特斯拉“撞死”机器人,是炒作还是事故?
- 问:PC机上的两个dns,是首用dns的查不到再查 备用的,是么?
- Python tensorflow ModuleNotFoundError: No module named ‘tensorflow.contrib‘
- boost::geometry::util::calculation_type用法的测试程序
- kernel panic 和 kernel Oops
- 网络知识 | 《图解TCP/IP》读书笔记(上)
- spring 面向接口编程_Spring面向方面的编程
- Xcode 7 App Transport Security has blocked a cleartext HTTP 报错解决办法
- Python面向对象编程 __init__方法
- ProcessOn画图
- python的十句名言_经典十句名言
- TensorFlow XLA优化原理与示例
- 学习记录583@IDEA导入子模块
- 解决阿里云盘分享文件数量太多而无法分享的问题
- 记一个小工具——font-spider(字蛛-css压缩中文字体字体)
- 公务员考试计算机专业类别,专业!公务员专业类别划分
- 用java实现四色定理
- 线性规划python
- 【源码】在线单纯形搜索的Nelder-Mead优化仿真
- QAxObject来操作Excel的一些命令
热门文章
- .NET 大会今日开幕 |这些白嫖福利不看肠子都悔青
- YARP+AgileConfig 5分钟实现一个支持配置热更新的代理网关
- ASP.NET Core 中做集成测试的三种方案
- ML.NET 示例:对象检测-ASP.NET Core Web和WPF桌面示例
- 如何在 ASP.Net Core 中使用 HTTP.sys WebServer ?
- 读书 | IT人如何直击本质洞察底层逻辑?
- IdentityServer4 之Client Credentials走起来
- ASP.NET Core Authentication and Authorization
- Orleans 知多少 | Orleans 中文文档上线
- Asp.Net Core多榜逆袭,这是.NET最好的时代!