I have a tab + ViewPager
layout and in one of these tabs I have a list view. When I replace that list fragment upon the onclick I can still see the old fragment u
Best code for it. clearly and not used another ram of device. on you Activity onCreate or before adding fragments add this code:
for (Fragment fragment : getSupportFragmentManager().getFragments()) {
if (fragment instanceof NavigationDrawerFragment) {
continue;
}
else if (fragment != null) {
getSupportFragmentManager().beginTransaction().remove(fragment).commit();
}
}
Happy coding :)