Can not perform this action after onSaveInstance错误
2015-02-04 21:14
267 查看
测试部挂monkey,跑出个这么个崩溃日志,分析来分析去也没分析出什么问题。
从搜索来看,还是有人遇到这个问题。
记录下。
http://zhiweiofli.iteye.com/blog/1539467
关于onSaveInstance方法和commit方法之间的关系,在FragmentManager.java (./framework/base/core/java/android/app/FragmentManager.java)
从上面可以看出,transaction的创建以及commit必须比activity的save要早。
从
可以看出。
分析log,量的时候比较轻松,量多了,整个十几个压缩包,真是一件痛苦的事。
因此,分析log掌握方法很有必要。比如查找对应的导致FC的进程id,然后根据这个id 顺藤摸瓜,或者根据事件code,比如keyCode = 4 是返回键,此时,
adb等工具命令排上用场。
从搜索来看,还是有人遇到这个问题。
记录下。
http://zhiweiofli.iteye.com/blog/1539467
关于onSaveInstance方法和commit方法之间的关系,在FragmentManager.java (./framework/base/core/java/android/app/FragmentManager.java)
/** * Start a series of edit operations on the Fragments associated with * this FragmentManager. * * <p>Note: A fragment transaction can only be created/committed prior * to an activity saving its state. If you try to commit a transaction * after {@link Activity#onSaveInstanceState Activity.onSaveInstanceState()} * (and prior to a following {@link Activity#onStart Activity.onStart} * or {@link Activity#onResume Activity.onResume()}, you will get an error. * This is because the framework takes care of saving your current fragments * in the state, and if changes are made after the state is saved then they * will be lost.</p> */ public abstract FragmentTransaction beginTransaction();
从上面可以看出,transaction的创建以及commit必须比activity的save要早。
从
private void checkStateLoss() { if (mStateSaved) { throw new IllegalStateException( "Can not perform this action after onSaveInstanceState"); } if (mNoTransactionsBecause != null) { throw new IllegalStateException( "Can not perform this action inside of " + mNoTransactionsBecause); } }
可以看出。
分析log,量的时候比较轻松,量多了,整个十几个压缩包,真是一件痛苦的事。
因此,分析log掌握方法很有必要。比如查找对应的导致FC的进程id,然后根据这个id 顺藤摸瓜,或者根据事件code,比如keyCode = 4 是返回键,此时,
adb等工具命令排上用场。
相关文章推荐
- 今天使用Fragment的时候,出现了这个错误 IllegalStateException: Can not perform this action after onSaveInstanceState
- Fragment错误:IllegalStateException: Can not perform this action after onSaveInstanceState
- Fragment错误:IllegalStateException: Can not perform this action after onSaveInstanceState
- 解决fragment错误 Can not perform this action after onSaveInstanceState
- Android 错误:IllegalStateException: Can not perform this action after onSaveInstanceState
- Android 错误:IllegalStateException: Can not perform this action after onSaveInstanceState
- 解决异常IllegalStateException: Can not perform this action after onSaveInstanceState
- 【转】解决IllegalStateException: Can not perform this action after onSaveInstanceState
- 解决IllegalStateException: 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问题解决
- IllegalStateException: Can not perform this action after onSaveInstanceState
- Can not perform this action after onSaveInstanceState
- IllegalStateException: Can not perform this action after onSaveInstanceState的解决方法
- Can not perform this action after onSaveInstanceState
- 解决Fragment IllegalStateException: Can not perform this action after onSaveInstanceState
- 解决IllegalStateException: Can not perform this action after onSaveInstanceState
- 解决IllegalStateException: Can not perform this action after onSaveInstanceState
- 解决IllegalStateException: Can not perform this action after onSaveInstanceState
- 解决IllegalStateException: Can not perform this action after onSaveInstanceState