标签:
错误:
java.lang.NullPointerException
11-15 09:04:21.023: E/AndroidRuntime(4057): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:591)
11-15 09:04:21.023: E/AndroidRuntime(4057): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1416
执行代码:
if (mCurTransaction != null) {
mCurTransaction.commitAllowingStateLoss();
// if (manager != null)
// manager.executePendingTransactions();
原因:当FragmentManager add,attach,remove,dettach时如果fragment为null,如add(null)
则容易mCurTransaction.commitAllowingStateLoss() 方法可能出现这个错误。
解决方法:在执行这些方法时判断fragment是否为null。 如if(fragment != null) add(fragment);
Android FragmentManager BackStackRecord.run throwing NullPointerException
标签:
原文地址:http://www.cnblogs.com/pandans/p/4757396.html