这更像是一个理论问题.
我有一种情况,我的应用程序崩溃与片段交换与executePendingTransactions()调用,并没有它工作正常.
我的问题是,如果我不调用executePendingTransactions(),一般会出现什么问题?
据我所知,没有这种方法,片段交换可能不会立即发生,虽然我从未经历过这种情况.
解决方法
除非您执行的操作取决于事务,否则不需要它.从
API documentation,
After a
FragmentTransaction
is committed with
FragmentTransaction.commit()
,it is scheduled to be executed asynchronously on the process’s main thread. If you want to immediately executing any such pending operations,you can call this function (only from the main thread) to do so. Note that all callbacks and other related behavior will be done from within this call,so be careful about where this is called from.