I\'m trying to decide and show a fragment in activity\'s onResume method, but in case a previously added fragment is chosen again, then the activity goes bl
You can try:
if( !(getSupportFragmentManager().findFragmentById(R.id.myLayout) instanceof FragmentA) ) { FragmentTransaction trans = getSupportFragmentManager().beginTransaction(); trans.replace(R.id.myLayout, fragA); trans.commit(); }
And I assume that fragA is FragmentA class object.