Пример #1
0
 public void removeDialog(Dialog d) {
   for (int i = 0; i < dialogs.size(); i++) {
     DialogWrapper p = dialogs.get(i);
     if (p.getDialog().equals(d)) {
       p.release();
       dialogs.remove(i);
       return;
     }
   }
 }
Пример #2
0
 private void releaseDialogs(boolean finish) {
   // clean up dialogs when activity is pausing or finishing
   for (Iterator<DialogWrapper> iter = dialogs.iterator(); iter.hasNext(); ) {
     DialogWrapper p = iter.next();
     Dialog dialog = p.getDialog();
     boolean persistent = p.getPersistent();
     // if the activity is pausing but not finishing, clean up dialogs only if
     // they are non-persistent
     if (finish || !persistent) {
       if (dialog != null && dialog.isShowing()) {
         dialog.dismiss();
       }
       dialogs.remove(p);
     }
   }
 }