Android AlertDialog Create showDownloadDialog(final Activity activity, CharSequence stringTitle, CharSequence stringMessage, CharSequence stringButtonYes, CharSequence stringButtonNo, final String uriString)

Here you can find the source of showDownloadDialog(final Activity activity, CharSequence stringTitle, CharSequence stringMessage, CharSequence stringButtonYes, CharSequence stringButtonNo, final String uriString)

Description

show Download Dialog

Declaration

private static AlertDialog showDownloadDialog(final Activity activity,
            CharSequence stringTitle, CharSequence stringMessage,
            CharSequence stringButtonYes, CharSequence stringButtonNo,
            final String uriString) 

Method Source Code

//package com.java2s;
import android.app.Activity;
import android.app.AlertDialog;

import android.content.DialogInterface;
import android.content.Intent;

import android.net.Uri;

public class Main {
    private static AlertDialog showDownloadDialog(final Activity activity,
            CharSequence stringTitle, CharSequence stringMessage,
            CharSequence stringButtonYes, CharSequence stringButtonNo,
            final String uriString) {
        AlertDialog.Builder downloadDialog = new AlertDialog.Builder(
                activity);//ww w .  j a  v a 2s  .  co  m
        downloadDialog.setTitle(stringTitle);
        downloadDialog.setMessage(stringMessage);
        downloadDialog.setPositiveButton(stringButtonYes,
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialogInterface,
                            int i) {
                        Uri uri = Uri.parse(uriString);
                        Intent intent = new Intent(Intent.ACTION_VIEW, uri);
                        activity.startActivity(intent);
                    }
                });
        downloadDialog.setNegativeButton(stringButtonNo,
                new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialogInterface,
                            int i) {
                    }
                });
        return downloadDialog.show();
    }
}

Related

  1. dismissProgressBar(ProgressDialog progressBar)
  2. showConnectionErrorDialog(Context c)
  3. showInfoDialog(String text, final Context context)
  4. makeSimpleDialog(Activity activity, String text)
  5. makeSimpleDialog(Activity activity, String title, String text)