Fragment f=fm.findFragmentByTag("f");
FragmentTransaction ft=fm.beginTransaction();
if(f!=null){
ft.remove(f);
Log.d("SIZE","something ");
}
else {
ft.replace(R.id.dialog, dtf, "f");
ft.addToBackStack("dialog");
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
}
ft.commit();