import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
+import java.util.List;
import de.dhbwloe.campusapp.fragments.PopupFragment;
return null;
if(oCurrentPage.fragmentType != 3)
return (CampusAppFragment)oCurrentFragment;
- return null;
+ else
+ return ((PopupFragment)oCurrentFragment).getCurrentFragment();
}
public void navigatePage(String name) {
oParentPage = oCurrentPage;
oParentFragment = oCurrentFragment;
history = false;
- } else if (oCurrentPage != null) {
- transaction.replace(iFragmentContainerId, fragment);
} else {
+ // remove fragments
+ List<Fragment> al = fragmentActivity.getSupportFragmentManager().getFragments();
+ if(al != null) {
+ for (Fragment frag : al) {
+ if (frag != null && frag.isAdded()) {
+ transaction.remove(frag);
+ }
+ }
+ }
transaction.add(iFragmentContainerId, fragment);
}
if (history)
public boolean closeDialog() {
if(oCurrentPage != null && oCurrentPage.fragmentType == 3) {
PopupFragment fragment = (PopupFragment) oCurrentFragment;
+ boolean wasAdded = false;
if(oCurrentFragment.isAdded()) {
fragment.destroyView();
transaction.remove(oCurrentFragment);
transaction.commit();
+ wasAdded = true;
}
oCurrentPage = oParentPage;
oCurrentFragment = oParentFragment;
-
- return true;
+ return wasAdded;
}
return false;
}