Example usage for android.app Activity dismissDialog

List of usage examples for android.app Activity dismissDialog

Introduction

In this page you can find the example usage for android.app Activity dismissDialog.

Prototype

@Deprecated
public final void dismissDialog(int id) 

Source Link

Document

Dismiss a dialog that was previously shown via #showDialog(int) .

Usage

From source file:org.totschnig.myexpenses.dialog.DialogUtils.java

/**
 * @return Dialog to be used from Preference,
 * and from version update/*  w  w w . ja  v  a  2  s .  c o m*/
 */
public static Dialog sendWithFTPDialog(final Activity ctx) {
    return new AlertDialog.Builder(ctx).setMessage(R.string.no_app_handling_ftp_available)
            .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    ctx.dismissDialog(R.id.FTP_DIALOG);
                    Intent intent = new Intent(Intent.ACTION_VIEW);
                    intent.setData(Uri.parse(MyApplication.getMarketPrefix() + "org.totschnig.sendwithftp"));
                    if (Utils.isIntentAvailable(ctx, intent)) {
                        ctx.startActivity(intent);
                    } else {
                        Toast.makeText(ctx.getBaseContext(), R.string.error_accessing_market, Toast.LENGTH_LONG)
                                .show();
                    }
                }
            }).setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    ctx.dismissDialog(R.id.FTP_DIALOG);
                }
            }).create();
}