Is there a way to remove all fragments which already added the specific view with its view id?
For example I want to remove all fragments which is added R.id.fragmentcon
Try this, hope it helps :D
try {
if(manager.getFragments()!=null){
if(manager.getBackStackEntryCount()>0) {
for (int i = 0; i < manager.getBackStackEntryCount(); i++)
manager.popBackStack();
manager.beginTransaction().remove(getSupportFragmentManager()
.findFragmentById(R.id.main_content))
.commit();
}
}
}catch (Exception e){
e.printStackTrace();
}