Answer the question
In order to leave comments, you need to log in
Why is FragmentTransaction fired in vain?
Good!
There is code in the snippet
public void onStart() {
super.onStart();
if (!transaction.isEmpty()) {
transaction.commit();
}
}
if (!transaction.isEmpty())will return
truefor some reason the app will crash
java.lang.IllegalStateException: Fragment already added:
Answer the question
In order to leave comments, you need to log in
In general, I would like to see more code. You are doing something wrong. Why is there some transaction in the fragment's onStart already? A typical way to use transactions is fm.beginTransaction().add()....commit(). That is, you do not need to store the transaction in a class field, and even more so, you do not need to transfer it somewhere.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question