catch illegal state exception on fragment transaction

This commit is contained in:
Daniel Gultsch 2018-11-17 12:59:19 +01:00
parent 51babc190a
commit 4f22859acf

View file

@ -1167,10 +1167,14 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
@NonNull @NonNull
@Override @Override
public Fragment instantiateItem(@NonNull ViewGroup container, int position) { public Fragment instantiateItem(@NonNull ViewGroup container, int position) {
Fragment fragment = getItem(position); final Fragment fragment = getItem(position);
FragmentTransaction trans = fragmentManager.beginTransaction(); final FragmentTransaction trans = fragmentManager.beginTransaction();
trans.add(container.getId(), fragment, "fragment:" + position); trans.add(container.getId(), fragment, "fragment:" + position);
try {
trans.commit(); trans.commit();
} catch (IllegalStateException e) {
//ignore
}
return fragment; return fragment;
} }