Android Utililty Methods AlertDialog Create

List of utility methods to do AlertDialog Create

Description

The list of methods to do AlertDialog Create are organized into topic(s).

Method

AlertDialognewMessageDialog(final Context context, String dialogTitle, String screenMessage, int iconResourceId)
Creates a new AlertDialog to display a simple message
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setCancelable(false);
builder.setPositiveButton("Okay", new OnClickListener() {
    public void onClick(DialogInterface dialog, int which) {
        dialog.dismiss();
});
builder.setTitle(dialogTitle);
...
voidshowAuthenticatedDialog(Context context, String title, String text)
show Authenticated Dialog
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(title);
builder.setMessage(text);
builder.setNeutralButton("OK",
        new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface arg0, int arg1) {
        });
builder.show(); 
voidshowMessageDialog(Context context, String title, String strText)
show Message Dialog
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(title);
builder.setMessage(strText);
builder.setNeutralButton("OK",
        new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface arg0, int arg1) {
        });
builder.show(); 
voidshowSingleDialog(Context context, String title, String msg, boolean cancelable)
Function to create AlertDialog
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setMessage(msg).setCancelable(cancelable).setTitle(title)
        .setPositiveButton("OK", new OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.cancel();
        });
...
DialoggetInstallationDialog(final Context context)
get Installation Dialog
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setMessage("SensApp application is needed. Would you like install it now?");
builder.setCancelable(false);
builder.setPositiveButton("Yes",
        new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                Uri uri = Uri.parse("market://details?id="
                        + "org.sensapp.android.sensappdroid");
...
voidshowDialog(Context context, String title, String message)
show Dialog
new AlertDialog.Builder(context).setTitle(title)
        .setMessage(message)
        .setPositiveButton(android.R.string.ok, null)
        .setIcon(android.R.drawable.ic_dialog_alert).show();
voidmakeDialogBox(Context context, String title, String message, String cancleButton, DialogInterface.OnClickListener cancelCallBack, String okayButton, DialogInterface.OnClickListener okayCallBack)
make Dialog Box
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(context);
alertBuilder.setTitle(title).setMessage(message)
        .setCancelable(true)
        .setNegativeButton(cancleButton, cancelCallBack)
        .setPositiveButton(okayButton, okayCallBack);
AlertDialog alertDialog = alertBuilder.create();
alertDialog.show();
voidsimpleDialogBox(Context context, String message)
simple Dialog Box
AlertDialog.Builder alertBuilder = new AlertDialog.Builder(context);
alertBuilder.setTitle("Photo Cache").setMessage(message)
        .setCancelable(true)
        .setPositiveButton("Okay", new OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
        });
AlertDialog alertDialog = alertBuilder.create();
alertDialog.show();
voiddismissProgressBar(ProgressDialog progressBar)
dismiss Progress Bar
progressBar.dismiss();
voidshowConnectionErrorDialog(Context c)
show Connection Error Dialog
AlertDialog.Builder builder = new AlertDialog.Builder(c);
builder.setTitle("Uh oh")
        .setMessage(
                "We were unable to reach openwatch.net. Please check your network connection and try again.")
        .setPositiveButton("Bummer",
                new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog,
...