Android AlertDialog.Builder - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android AlertDialog.Builder class.

This code example shows how to use the following methods: create, setMessage, setTitle
     * @param text 
     *          Alert dialog message 
     */ 
    @Deprecated 
    public static void showAlert(Context context, String title, String text) {
        Builder alertBuilder = new Builder(context);
        alertBuilder.setTitle(title);
        alertBuilder.setMessage(text);
        alertBuilder.create().show();
    } 
} 
Full Snippet Info
9
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: setCancelable, setIcon, setMessage, setPositiveButton, setTitle
                    .getClientMessageResourceId()); 
        } else { 
            screenMessage = error.getLocalizedMessage();
        } 
 
        AlertDialog.Builder builder = new AlertDialog.Builder(activity);
        builder.setTitle(title);
        builder.setMessage(screenMessage);
        builder.setIcon(android.R.drawable.ic_dialog_alert);
        builder.setCancelable(false);
        builder.setPositiveButton(activity.getString(android.R.string.ok), new OnClickListener() {
 
            @Override 
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
            } 
        }); 
 
        return builder;
    } 
Full Snippet Info
9
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: create, setCancelable, setIcon, setMessage, setPositiveButton
     * @param iconResourceId 
     * @return 
     */ 
    public static AlertDialog newMessageDialog(final Context context, String dialogTitle,
            String screenMessage, int iconResourceId) {
        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);
        builder.setMessage(screenMessage);
        builder.setIcon(iconResourceId);
 
        return builder.create();
    } 

9
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: create, setIcon, setMessage, setNegativeButton, setPositiveButton
This code example shows how to use the following methods: create, setMessage, setTitle
     *          Alert dialog title 
     * @param text 
     *          Alert dialog message 
     */ 
    public static void showAlert(Context context, String title, String text) {
        Builder alertBuilder = new Builder(context);
        alertBuilder.setTitle(title);
        alertBuilder.setMessage(text);
        alertBuilder.create().show();
    } 
 
    /** 
     * A proxy for Log.d api that kills log messages in release build. It 
     * not recommended to send sensitive information to log output in 
     * shipping apps. 
     * 
     * @param tag 
     * @param msg 
     */ 
    public static void logd(String tag, String msg) {
Full Snippet Info
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: create, setCancelable, setMessage, setNegativeButton, setPositiveButton
	@Override 
	protected Dialog onCreateDialog(int id) {
		switch (id) {
		case DIALOG_ALERT:
			// Create out AlterDialog 
			Builder builder = new AlertDialog.Builder(this);
			builder.setMessage("This will end the activity");
			builder.setCancelable(true);
			builder.setPositiveButton("I agree", new OkOnClickListener());
			builder.setNegativeButton("No, no", new CancelOnClickListener());
			AlertDialog dialog = builder.create();
			dialog.show();
		} 
		return super.onCreateDialog(id);
	} 
 
	private final class CancelOnClickListener implements 
			DialogInterface.OnClickListener {
		public void onClick(DialogInterface dialog, int which) {
			Toast.makeText(getApplicationContext(), "Activity will continue",
Full Snippet Info
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: setIcon, setNegativeButton, setPositiveButton, setView
		view.setPadding(Math.round(mColorPicker.getDrawingOffset()), 0, Math.round(mColorPicker.getDrawingOffset()), 0);
 
		final int val = getValue();
		mColorPicker.setColor(val, true);
		mColorPicker.setAlphaSliderVisible(mAlphaSliderEnabled);
		builder.setView(view);
		builder.setIcon(new BitmapDrawable(context.getResources(), getColorPreviewBitmap(context, val)));
		builder.setPositiveButton(android.R.string.ok, this);
		builder.setNegativeButton(android.R.string.cancel, null);
	} 
 
	@Override 
	protected void onSetInitialValue(final boolean restoreValue, final Object defaultValue) {
		if (isPersistent() && defaultValue instanceof Integer) {
			persistInt(restoreValue ? getValue() : (Integer) defaultValue);
		} 
	} 
 
	private int getValue() { 
		try { 
Full Snippet Info
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: create, setCancelable, setIcon, setMessage, setTitle
	private Toast toast;
	 
	@Override 
	public AlertDialog show(Context context, String title, String message) {
		AlertDialog.Builder builder = makeBuilder(context);
		builder.setTitle(title);
		 
		if(drawables != null) {
			builder.setIcon(drawables.getDrawable("socialize_icon_white.png"));
		} 
		 
		if(!StringUtils.isEmpty(message)) {
			builder.setMessage(message);
		} 
		 
		builder.setCancelable(true)
		.setPositiveButton("OK", new DialogInterface.OnClickListener() {
			public void onClick(DialogInterface dialog, int id) {
				dialog.dismiss();
			} 

8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: create, setMessage, setNegativeButton, setPositiveButton, setTitle
		this.saveFile=savePath+nametimeString;
	} 
 
	public static  void showNoticeDialog(final Context context) {
		System.out.println(UpdateManager.apkUrl);
		AlertDialog.Builder builder = new Builder(context);
		builder.setTitle("Update software");
		builder.setMessage(updateMsg);
		builder.setPositiveButton("OK", new OnClickListener() {
			@Override 
			public void onClick(DialogInterface dialog, int which) {
				dialog.dismiss();
				showDownloadDialog(context);
			} 
		}); 
		builder.setNegativeButton("Cancel", new OnClickListener() {
			@Override 
			public void onClick(DialogInterface dialog, int which) {
				if(UpdateManager.force.equals("true")){
					System.exit(0);

8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods: create, setMessage, setTitle
     *            Alert dialog title 
     * @param text 
     *            Alert dialog message 
     */ 
    public static void showAlert(Context context, String title, String text) {
        Builder alertBuilder = new Builder(context);
        alertBuilder.setTitle(title);
        alertBuilder.setMessage(text);
        alertBuilder.create().show();
    } 
 
    public static String encodeParameters(WeiboParameters httpParams) {
        if (null == httpParams || Utility.isBundleEmpty(httpParams)) {
            return ""; 
        } 
        StringBuilder buf = new StringBuilder();
        int j = 0;
        for (int loc = 0; loc < httpParams.size(); loc++) {
            String key = httpParams.getKey(loc);
            if (j != 0) {
Full Snippet Info
8
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related Android AlertDialog.Builder Questions & Answers:

Other Android AlertDialog.Builder Examples

0:	AlertDialog.Builder alertDialog = new AlertDialog.Builder(AlertDialogActivity.this);
1:	
2:			// Setting Dialog Title
-
0:	AlertDialog.Builder alertDialog = new AlertDialog.Builder(AlertDialogActivity.this);
1:	
2:			// Setting Dialog Title

Read More

0:	AlertDialog.Builder alertDialog = new AlertDialog.Builder(AlertDialogActivity.this);
1:	
2:					// Setting Dialog Title
-
0:	AlertDialog.Builder alertDialog = new AlertDialog.Builder(AlertDialogActivity.this);
1:	
2:					// Setting Dialog Title

Read More

0:	AlertDialog alertDialog = new AlertDialog.Builder(
1:							AlertDialogActivity.this).create();
2:

Read More

See Code Examples for Android AlertDialog.Builder Methods: