public String getCurrentPageName() {
if(oCurrentPage == null)
return null;
+ if(oCurrentPage.fragmentType == 3 && oParentFragment != null){
+ if(oCurrentFragment.isAdded())
+ return oCurrentPage.name;
+ else {
+ closeDialog();
+ }
+ }
return oCurrentPage.name;
}
public boolean closeDialog() {
if(oCurrentPage != null && oCurrentPage.fragmentType == 3) {
PopupFragment fragment = (PopupFragment) oCurrentFragment;
- fragment.destroyView();
+ boolean wasAdded = false;
+ if(oCurrentFragment.isAdded()) {
+ fragment.destroyView();
- FragmentActivity fragmentActivity = (FragmentActivity) AppContext.getMainActivity();
- FragmentTransaction transaction = fragmentActivity.getSupportFragmentManager().beginTransaction();
+ FragmentActivity fragmentActivity = (FragmentActivity) AppContext.getMainActivity();
+ FragmentTransaction transaction = fragmentActivity.getSupportFragmentManager().beginTransaction();
- transaction.remove(oCurrentFragment);
+ transaction.remove(oCurrentFragment);
+ transaction.commit();
+ wasAdded = true;
+ }
oCurrentPage = oParentPage;
oCurrentFragment = oParentFragment;
- transaction.commit();
- return true;
+ return wasAdded;
}
return false;
}