Example usage for android.app AlertDialog.Builder setTitle

List of usage examples for android.app AlertDialog.Builder setTitle

Introduction

In this page you can find the example usage for android.app AlertDialog.Builder setTitle.

Prototype

@Override
    public void setTitle(CharSequence title) 

Source Link

Usage

From source file:com.fanfou.app.opensource.service.DownloadService.java

public static void showUpdateConfirmDialog(final Context context, final AppVersionInfo info) {
    final DialogInterface.OnClickListener downListener = new DialogInterface.OnClickListener() {

        @Override/*  ww  w . ja va 2 s.co  m*/
        public void onClick(final DialogInterface dialog, final int which) {
            DownloadService.startDownload(context, info);
        }
    };
    final AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setTitle("???").setCancelable(true).setNegativeButton("??",
            null);
    builder.setPositiveButton("??", downListener);
    final StringBuffer sb = new StringBuffer();
    sb.append("").append(AppContext.appVersionName).append("(Build")
            .append(AppContext.appVersionCode).append(")");
    sb.append("\n").append(info.versionName).append("(Build").append(info.versionCode)
            .append(")");
    sb.append("\n").append(info.releaseDate);
    sb.append("\n").append(info.forceUpdate ? "???" : "?");
    sb.append("\n\n").append(info.changelog);
    builder.setMessage(sb.toString());
    final AlertDialog dialog = builder.create();
    dialog.show();

}

From source file:com.spoiledmilk.ibikecph.util.Util.java

public static void showLanguageDialog(final Activity activity) {
    AlertDialog.Builder builder = new AlertDialog.Builder(activity);
    builder.setTitle(IbikeApplication.getString("choose_language"));
    builder.setItems(IbikePreferences.getLanguageNames(), new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int item) {
            ((IbikeApplication) activity.getApplication()).changeLanguage(Language.values()[item + 1]);
            ((iLanguageListener) activity).reloadStrings();
            dialog.dismiss();/*w  w  w .  j  a  v a  2 s . com*/
        }
    });
    builder.setPositiveButton(IbikeApplication.getString("Cancel"), new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            dialog.cancel();
        }
    });
    builder.show();
}

From source file:com.todotxt.todotxttouch.util.Util.java

public static void showDialog(Context cxt, int titleid, int msgid) {
    AlertDialog.Builder builder = new AlertDialog.Builder(cxt);
    builder.setTitle(titleid);
    builder.setMessage(msgid);/*from  w  w  w .jav a 2  s . com*/
    builder.setPositiveButton(android.R.string.ok, null);
    builder.setCancelable(true);
    builder.show();
}

From source file:com.todotxt.todotxttouch.util.Util.java

public static void showDialog(Context cxt, int titleid, String msg) {
    AlertDialog.Builder builder = new AlertDialog.Builder(cxt);
    builder.setTitle(titleid);
    builder.setMessage(msg);/*  ww w. ja  va2  s  .c  o  m*/
    builder.setPositiveButton(android.R.string.ok, null);
    builder.setCancelable(true);
    builder.show();
}

From source file:com.todotxt.todotxttouch.util.Util.java

public static void showDeleteConfirmationDialog(Context cxt, OnClickListener oklistener) {
    AlertDialog.Builder builder = new AlertDialog.Builder(cxt);
    builder.setTitle(R.string.delete_task_title);
    builder.setMessage(R.string.delete_task_message);
    builder.setPositiveButton(R.string.delete_task_confirm, oklistener);
    builder.setNegativeButton(R.string.cancel, null);
    builder.show();//from w  w  w.  j a v a 2 s  .c o  m
}

From source file:org.ubicompforall.cityexplorer.gui.ImportWebTab.java

/**
  * Display a dialog for explaining the user the process of downloading a database.
  *///from  w  ww  . jav  a 2  s  .co m
private static void showDownloadDialog(Activity context) {

    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setCancelable(true);

    builder.setMessage(R.string.download_dialog);
    builder.setTitle(R.string.download_dialog_title);

    builder.setPositiveButton(R.string.download_dialog_ok, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            return;
        }
    });

    builder.show();
}

From source file:nl.mpcjanssen.simpletask.util.Util.java

public static AlertDialog createDeferDialog(final Activity act, int dateType, final boolean showNone,
        final InputDialogListener listener) {
    String[] keys = act.getResources().getStringArray(R.array.deferOptions);
    String today = "0d";
    String tomorrow = "1d";
    String oneWeek = "1w";
    String twoWeeks = "2w";
    String oneMonth = "1m";
    final String[] values = { "", today, tomorrow, oneWeek, twoWeeks, oneMonth, "pick" };
    if (!showNone) {
        keys = Arrays.copyOfRange(keys, 1, keys.length);
    }//from  w  w w  .  j  a v a  2s  .c  o  m
    int titleId;
    if (dateType == Task.DUE_DATE) {
        titleId = R.string.defer_due;
    } else {
        titleId = R.string.defer_threshold;
    }

    AlertDialog.Builder builder = new AlertDialog.Builder(act);
    builder.setTitle(titleId);
    builder.setItems(keys, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int whichButton) {
            if (!showNone) {
                whichButton++;
            }
            String selected = values[whichButton];
            listener.onClick(selected);
        }
    });
    return builder.create();
}

From source file:de.ub0r.android.lib.DonationHelper.java

/**
 * Show "donate" dialog.//from  w  w w  . jav a  2  s .c o m
 * 
 * @param context
 *            {@link Context}
 * @param title
 *            title
 * @param btnDonate
 *            button text for donate
 * @param btnNoads
 *            button text for "i did a donation"
 * @param messages
 *            messages for dialog body
 */
public static void showDonationDialog(final Activity context, final String title, final String btnDonate,
        final String btnNoads, final String[] messages) {
    final Intent marketIntent = Market.getInstallAppIntent(context, DONATOR_PACKAGE, null);

    String btnTitle = String.format(btnDonate, "Play Store");

    SpannableStringBuilder sb = new SpannableStringBuilder();
    for (String m : messages) {
        sb.append(m);
        sb.append("\n");
    }
    sb.delete(sb.length() - 1, sb.length());
    sb.setSpan(new RelativeSizeSpan(0.75f), 0, sb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    AlertDialog.Builder b = new AlertDialog.Builder(context);
    b.setTitle(title);
    b.setMessage(sb);
    b.setCancelable(true);
    b.setPositiveButton(btnTitle, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(final DialogInterface dialog, final int which) {
            try {
                context.startActivity(marketIntent);
            } catch (ActivityNotFoundException e) {
                Log.e(TAG, "activity not found", e);
                Toast.makeText(context, "activity not found", Toast.LENGTH_LONG).show();
            }
        }
    });
    b.setNeutralButton(btnNoads, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(final DialogInterface dialog, final int which) {
            try {
                context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(
                        "http://code.google.com/p/ub0rapps/downloads/list?" + "can=3&q=Product%3DDonator")));
            } catch (ActivityNotFoundException e) {
                Log.e(TAG, "activity not found", e);
                Toast.makeText(context, "activity not found", Toast.LENGTH_LONG).show();
            }
        }
    });
    b.show();
}

From source file:com.otaupdater.utils.Utils.java

public static void showProKeyOnlyFeatureDialog(final Context ctx, final DialogCallback callback) {
    AlertDialog.Builder builder = new AlertDialog.Builder(ctx);
    builder.setTitle(R.string.prokey_only_feature_title);
    builder.setMessage(R.string.prokey_only_feature_message);
    builder.setPositiveButton(R.string.prokey_only_get, new DialogInterface.OnClickListener() {
        @Override/*from  ww w .  j ava 2  s  . c  o m*/
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
            Intent i = new Intent(ctx, SettingsActivity.class);
            i.setAction(SettingsActivity.EXTRA_SHOW_GET_PROKEY_DLG);
            i.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
            ctx.startActivity(i);
        }
    });
    builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });

    final AlertDialog dlg = builder.create();
    dlg.setOnShowListener(new DialogInterface.OnShowListener() {
        @Override
        public void onShow(DialogInterface dialog) {
            if (callback != null)
                callback.onDialogShown(dlg);
        }
    });
    dlg.setOnDismissListener(new DialogInterface.OnDismissListener() {
        @Override
        public void onDismiss(DialogInterface dialog) {
            if (callback != null)
                callback.onDialogClosed(dlg);
        }
    });
    dlg.show();
}

From source file:com.todotxt.todotxttouch.util.Util.java

public static void showConfirmationDialog(Context cxt, int msgid, OnClickListener oklistener, int titleid) {
    AlertDialog.Builder builder = new AlertDialog.Builder(cxt);
    // builder.setTitle(cxt.getPackageName());
    builder.setTitle(titleid);
    builder.setMessage(msgid);/*from  w ww  .ja v  a 2  s  . co m*/
    builder.setPositiveButton(android.R.string.ok, oklistener);
    builder.setNegativeButton(android.R.string.cancel, null);
    builder.setCancelable(true);
    builder.show();
}