title: How to check that AlertDialog was destroyed
body: <p>I have opened AlertDialog from fragment, after that I closed AlertDialog and returned the data to parent fragment.</p>
  
  <p>== Parent fragment code</p>
  
  <pre><code> @Override
   public void onListItemClick(ListView l, View v, int position, long id) {
  
      super.onListItemClick(l, v, position, id);
  
      Bundle arguments = new Bundle();
      arguments.putInt("type", 1100); 
  
      DialogFragment dialog = AddDialog.newInstance();
      dialog.setArguments(arguments);
      dialog.setTargetFragment(this, CREATE_PAYMENT);
      dialog.show(getFragmentManager(), "dialog");
  }
  </code></pre>
  
  <p>== AlertDialog code</p>
  
  <pre><code>@Override
   public Dialog onCreateDialog(Bundle savedInstanceState) {
      LayoutInflater inflater = activity.getLayoutInflater();
      final View view = inflater.inflate(R.layout.payment_add, null);
  
      final AlertDialog.Builder builder = new AlertDialog.Builder(activity);
      builder.setView(view);
  
      builder.setView(view).setPositiveButton(R.string.btnSend, null);
  
      final AlertDialog d = builder.create();
      d.setOnShowListener(new DialogInterface.OnShowListener() {
  
          @Override
          public void onShow(DialogInterface dialog) {
  
              Button b = d.getButton(AlertDialog.BUTTON_POSITIVE);
              b.setOnClickListener(new View.OnClickListener() {
  
                  @Override
                  public void onClick(View view) {
                      // .... do something
  
                          Intent intent = new Intent();
                          intent.putExtra("payment", operation);
                          getTargetFragment().onActivityResult(getTargetRequestCode(),
                                  Activity.RESULT_OK, intent);
                          d.dismiss();
                      }
                  }
              });
          }
      });
  
      return d;
   }
  </code></pre>
  
  <p>After press Ok I've returned to parent fragment, done some operations and replace parent fragment to another one.
    But unfortunately during replacing fragments there is trembling of new fragment because I think AlertDialog doesn't destroyed from main Activity after dismiss();</p>
  
  <p>I think so because I don't have such a trembling with the same fragment in other parts of program where there isn't AlertDialog.</p>
  
  <p>== Parent fragment code</p>
  
  <pre><code>@Override
  public void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
      if (resultCode == Activity.RESULT_OK) {
          switch (requestCode) {
  
              // ... do something
  
             Sign newFragment = Sign.newInstance(new_operation);
             FragmentManager fragmentManager =   getActivity().getSupportFragmentManager();
             fragmentManager.beginTransaction()
                  .replace(R.id.main, newFragment)
                  .addToBackStack(null)
                  .commit();
  
             break;
          }
      }
  }
  </code></pre>
  
  <p>How to replace fragment just after AlertDialog has been closed and destroyed.</p>
  
  <p>Thanx.</p>