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

AlertDialogcreateOpenSourceDialog( final Context context)
create Open Source Dialog
final WebView webView = new WebView(context);
webView.loadUrl("file:///android_asset/licenses.html");
return new AlertDialog.Builder(context)
        .setTitle(R.string.settings_open_source_licenses)
        .setView(webView)
        .setPositiveButton(android.R.string.ok,
                new DialogInterface.OnClickListener() {
                    @Override
...
voidshowAlert(Activity activity, String message)
show Alert
showAlert(activity, "", message);
voidshowAlert(Activity activity, String title, String message)
show Alert
AlertDialog.Builder ad = new AlertDialog.Builder(activity);
ad.setTitle(title);
ad.setMessage(message);
ad.setNegativeButton("OK", null);
ad.setCancelable(true);
ad.show();
voidshowAlert(Activity activity, int messageStringId)
show Alert
Resources res = activity.getResources();
showAlert(activity, "", res.getString(messageStringId));
voidshowAlert(Activity activity, int titleStringId, int messageStringId)
show Alert
Resources res = activity.getResources();
showAlert(activity, res.getString(titleStringId),
        res.getString(messageStringId));
voidshowAlert(Context context, int titleId, String message)
Show Alert Dialog
Dialog dlg = new AlertDialog.Builder(context)
        .setIcon(android.R.drawable.ic_dialog_alert)
        .setTitle(titleId)
        .setPositiveButton(android.R.string.ok, null)
        .setMessage(message).create();
dlg.show();
voidshowAlert(Context context, int titleId, String message, CharSequence positiveButtontxt, DialogInterface.OnClickListener positiveListener)
Show Alert Dialog
Dialog dlg = new AlertDialog.Builder(context)
        .setIcon(android.R.drawable.ic_dialog_alert)
        .setTitle(titleId)
        .setPositiveButton(positiveButtontxt, positiveListener)
        .setMessage(message).setCancelable(false).create();
dlg.show();
voidshowAlert(Context context, int titleId, int messageId)
Show Alert Dialog
Dialog dlg = new AlertDialog.Builder(context)
        .setIcon(android.R.drawable.ic_dialog_alert)
        .setTitle(titleId)
        .setPositiveButton(android.R.string.ok, null)
        .setMessage(messageId).create();
dlg.show();
voidshowAlert(Context context, int titleId, int messageId, CharSequence positiveButtontxt, DialogInterface.OnClickListener positiveListener, CharSequence negativeButtontxt, DialogInterface.OnClickListener negativeListener)
Show Alert Dialog
Dialog dlg = new AlertDialog.Builder(context)
        .setTitle(titleId)
        .setPositiveButton(positiveButtontxt, positiveListener)
        .setNegativeButton(negativeButtontxt, negativeListener)
        .setMessage(messageId).setCancelable(false).create();
dlg.show();
voidshowAlert(Context parent, String alert)
show Alert
new AlertDialog.Builder(parent).setTitle("Error").setMessage(alert)
        .setNeutralButton("Close", null).show();