Android FragmentTransaction commit When?
Try running fragmentManager.executePendingTransactions()
after committing your transaction but before finding by tag and see if that works for you.
In Android API 24 FragmentTransaction
has synchronous .commitNow()
method.
It's in the reference now: https://developer.android.com/reference/android/app/FragmentTransaction.html#commitNow()
On the contrary, .commit()
works asynchronously. It just schedules a commit of the transaction.