This is actually quite simple:
let's say you added a snippet as follows:
fragmentTransac.add(R.id.content, fragA);
instead, you add it also with TAG
fragmentTransac.add(R.id.content, new FragA(), "first");
fragmentTransac.add(R.id.content, new FragA(), "second");
then delete:
Fragment f = getFragmentManager().findFragmentByTag("first");
if(f!=null) fragmentTransac.remove(f);
fragmentTransac.commit();
happy coding =]
source
share