Difference between removeDialog(), dismissDialog() and dismiss()

Viewed 2752

What is different between removeDialog() and dismiss() and dismissDialog()? because I'm able to use them together without any problem.

And is it matter when implementing DialogInterface.OnClickListener or AlertDialog.OnClickListener?

I searched a lot but couldn't find anything useful.

EDIT: I'm developing for Android 2.3.

Example code:

public final class OptionsPreference extends PreferenceActivity implements DialogInterface.OnClickListener
{
private AlertDialog noInternetDialog = null;
//...

    @Override
    protected void onPause()
    {
        if (this.noInternetDialog != null)
        {
            Log.d(LOG_TAG, "Destroying noInternetDialog...");
            this.noInternetDialog.dismiss(); // X?
            removeDialog(DIALOG_NOINTERNET); // X?
            dismissDialog(DIALOG_NOINTERNET); // X?
            this.noInternetDialog = null;
        }
        super.onPause();
    }

    @Override
    protected final Dialog onCreateDialog(final int id)
    {
        switch (id)
        {
            case DIALOG_NOINTERNET:
            {
                final AlertDialog.Builder _builder = new AlertDialog.Builder(this).setIcon(android.R.drawable.ic_dialog_info).setMessage(R.string.str_nointernet);
                _builder.setCancelable(false);
                _builder.setPositiveButton(R.string.str_wifisettings, this);
                _builder.setNeutralButton(R.string.str_ok, this);
                this.noInternetDialog = _builder.create();
                if (!isFinishing())
                {
                    this.noInternetDialog.show();
                }
                return this.noInternetDialog;
            }
// ...
}
1 Answers
Related