Best code examples for Android AlertDialog.Builder class (android.app.AlertDialog.Builder)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android AlertDialog.Builder class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Android AlertDialog.Builder examples from Open Source projects
This code example shows how to use the following methods: create, setMessage, setTitle
309:	Builder alertBuilder = new Builder(context); 
310:	alertBuilder.setTitle(title); 
311:	alertBuilder.setMessage(text); 
312:	alertBuilder.create().show(); 
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: setCancelable, setIcon, setMessage, setPositiveButton, setTitle
174:	AlertDialog.Builder builder = new AlertDialog.Builder(activity); 
175:	builder.setTitle(title); 
176:	builder.setMessage(screenMessage); 
177:	builder.setIcon(android.R.drawable.ic_dialog_alert); 
178:	builder.setCancelable(false); 
179:	builder.setPositiveButton(activity.getString(android.R.string.ok), new OnClickListener() { 
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: create, setCancelable, setIcon, setMessage, setPositiveButton
138:	AlertDialog.Builder builder = new AlertDialog.Builder(context); 
139:	builder.setCancelable(false); 
140:	builder.setPositiveButton("Okay", new OnClickListener() { 
-
147:	builder.setTitle(dialogTitle); 
148:	builder.setMessage(screenMessage); 
149:	builder.setIcon(iconResourceId); 
-
151:	return builder.create(); 
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: create, setIcon, setMessage, setNegativeButton, setPositiveButton
46:	Builder b = new Builder(getActivity()); 
47:	b.setTitle(args.getString(BUNDLE_TITLE)); 
48:	b.setMessage(args.getString(BUNDLE_MESSAGE)); 
49:	b.setIcon(android.R.drawable.ic_dialog_alert); 
-
51:	b.setPositiveButton(args.getString(BUNDLE_POSITIVE_BUTTON_TEXT), mPositiveOnClickListener); 
52:	b.setNegativeButton(args.getString(BUNDLE_NEGATIVE_BUTTON_TEXT), mNegativeOnClickListener); 
53:	return b.create(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: create, setMessage, setTitle
310:	Builder alertBuilder = new Builder(context); 
311:	alertBuilder.setTitle(title); 
312:	alertBuilder.setMessage(text); 
313:	alertBuilder.create().show(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: create, setCancelable, setMessage, setNegativeButton, setPositiveButton
34:	Builder builder = new AlertDialog.Builder(this); 
35:	builder.setMessage("This will end the activity"); 
36:	builder.setCancelable(true); 
37:	builder.setPositiveButton("I agree", new OkOnClickListener()); 
38:	builder.setNegativeButton("No, no", new CancelOnClickListener()); 
39:	AlertDialog dialog = builder.create(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setIcon, setNegativeButton, setPositiveButton, setView
117:	builder.setView(view); 
118:	builder.setIcon(new BitmapDrawable(context.getResources(), getColorPreviewBitmap(context, val))); 
119:	builder.setPositiveButton(android.R.string.ok, this); 
120:	builder.setNegativeButton(android.R.string.cancel, null); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: create, setCancelable, setIcon, setMessage, setTitle
44:	builder.setTitle(title); 
-
47:	builder.setIcon(drawables.getDrawable("socialize_icon_white.png")); 
-
51:	builder.setMessage(message); 
-
54:	builder.setCancelable(true) 
-
61:	AlertDialog alert = builder.create(); 
-
80:	return new AlertDialog.Builder(context); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: create, setMessage, setNegativeButton, setPositiveButton, setTitle
103:	AlertDialog.Builder builder = new Builder(context); 
104:	builder.setTitle("Update software"); 
105:	builder.setMessage(updateMsg); 
106:	builder.setPositiveButton("OK", new OnClickListener() { 
-
113:	builder.setNegativeButton("Cancel", new OnClickListener() { 
-
123:	noticeDialog = builder.create(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: create, setMessage, setTitle
619:	Builder alertBuilder = new Builder(context); 
620:	alertBuilder.setTitle(title); 
621:	alertBuilder.setMessage(text); 
622:	alertBuilder.create().show(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setPadding, addView, setView
34:	.setView(LinkifyText(context, text)) 
-
40:	ScrollView svMessage = new ScrollView(context); 
-
49:	svMessage.setPadding(14, 2, 10, 12); 
50:	svMessage.addView(tvMessage); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setAdapter, setTitle, show
142:	AlertDialog.Builder builder = new Builder(this); 
-
152:	builder.setTitle("Choose your file"); 
153:	builder.setAdapter(adapter, new DialogInterface.OnClickListener() { 
-
206:	dialog = builder.show(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: create, setMessage, setTitle
290:	Builder alertBuilder = new Builder(context); 
291:	alertBuilder.setTitle(title); 
292:	alertBuilder.setMessage(text); 
293:	alertBuilder.create().show(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: create, setCancelable, setMessage, setNegativeButton, setPositiveButton
77:	Builder builder = new AlertDialog.Builder(this); 
78:	builder.setMessage("This will end the activity"); 
79:	builder.setCancelable(true); 
80:	builder.setPositiveButton("I agree", new OkOnClickListener()); 
81:	builder.setNegativeButton("No, no", new CancelOnClickListener()); 
82:	AlertDialog dialog = builder.create(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: create, setMessage, setTitle
22:	Builder alertDialog = new AlertDialog.Builder(getActivity()); 
23:	alertDialog.setTitle("Alert!"); 
24:	alertDialog.setMessage("This is a notication dialog"); 
25:	return alertDialog.create(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: addLinks, setMessage
31:	final SpannableString msg = new SpannableString(text); 
32:	Linkify.addLinks(msg, Linkify.ALL); 
-
43:	.setMessage(getLinkifiedText(context, msgId)); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setLayoutParams, setNumStars, setOnRatingBarChangeListener, setRating, setStepSize
68:	final RatingBar popupRatingBar = new RatingBar(context); 
69:	popupRatingBar.setNumStars(mRatingBar.getNumStars()); 
70:	popupRatingBar.setStepSize(mRatingBar.getStepSize()); 
71:	popupRatingBar.setRating(mRatingBar.getRating()); 
72:	popupRatingBar.setOnRatingBarChangeListener(this); 
-
74:	final AlertDialog dialog = new AlertDialog.Builder(context).setView(popupRatingBar) 
-
76:	popupRatingBar.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: loadData, setLayoutParams, setView
35:	WebView html = new WebView(c); 
36:	html.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); 
37:	html.loadData(loadAssetFile(c, c.getString(filenameid)), "text/html", "UTF-8"); 
-
39:	.setView(html) 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: create, setCancelable, setMessage, setPositiveButton, setTitle
74:	AlertDialog.Builder builder = new Builder(context); 
75:	builder.setMessage(s); 
-
77:	builder.setTitle(title); 
78:	builder.setPositiveButton(android.R.string.ok, okCallback); 
79:	builder.setCancelable(false); 
80:	builder.create().show(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: create, setSingleChoiceItems
79:	mBuilder.setSingleChoiceItems( mOptions, checkedItem, clickListener ); 
80:	AlertDialog dialog = mBuilder.create(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: create, setMessage, setTitle
22:	Builder alertBuilder = new Builder(this); 
23:	alertBuilder.setTitle("Warning"); 
24:	alertBuilder.setMessage("A Facebook Applicaton ID must be " + 
-
26:	alertBuilder.create().show(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: create, setMessage, setTitle
311:	Builder alertBuilder = new Builder(context); 
312:	alertBuilder.setTitle(title); 
313:	alertBuilder.setMessage(text); 
314:	alertBuilder.create().show(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setItems, setTitle, show
61:	AlertDialog.Builder builder = new Builder(this); 
-
65:	builder.setTitle("Choose your background"); 
-
71:	builder.setItems(mFileList, new DialogInterface.OnClickListener(){ 
-
79:	dialog = builder.show(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setMessage, setNegativeButton, setPositiveButton, setTitle, setView
214:	AlertDialog.Builder alert = new AlertDialog.Builder(this); 
215:	alert.setTitle("Add Gameplan"); 
216:	alert.setMessage("Type in name of gameplan to add"); 
-
218:	alert.setView(input); 
219:	alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() { 
-
237:	alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { 
-
242:	alert.show(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: create, setMessage, setTitle
177:	AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this); 
178:	dialogBuilder.setTitle("Can't complete registration"); 
179:	dialogBuilder.setMessage("The password and the confirmation password don't match"); 
180:	Dialog dialog = dialogBuilder.create(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: create, setMessage, setTitle
290:	Builder alertBuilder = new Builder(context); 
291:	alertBuilder.setTitle(title); 
292:	alertBuilder.setMessage(text); 
293:	alertBuilder.create().show(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: create, setCancelable, setMessage, setNegativeButton, setPositiveButton
45:	Builder builder = new AlertDialog.Builder(this); 
46:	builder.setMessage("This will end the activity"); 
47:	builder.setCancelable(true); 
48:	builder.setPositiveButton("I agree", new OkOnClickListener()); 
49:	builder.setNegativeButton("No, no", new CancelOnClickListener()); 
50:	AlertDialog dialog = builder.create(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setMessage, setNeutralButton, setTitle, show
32:	AlertDialog.Builder mensagem = new 
-
34:	mensagem.setTitle("Aviso"); 
35:	mensagem.setMessage("Soma:"+ resultado); 
36:	mensagem.setNeutralButton("OK", null); 
37:	mensagem.show(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: create, setCancelable, setMessage, setPositiveButton, setTitle
38:	Builder b = new AlertDialog.Builder(context); 
39:	b.setTitle("You Have Arrived"); 
40:	b.setMessage("Your current location is on your pin."); 
41:	b.setCancelable(true); 
42:	b.setPositiveButton("OK", new DialogInterface.OnClickListener() { 
-
50:	AlertDialog ad = b.create(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: create, setMessage, setTitle
297:	Builder alertBuilder = new Builder(context); 
298:	alertBuilder.setTitle(title); 
299:	alertBuilder.setMessage(text); 
300:	alertBuilder.create().show(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: create, setMessage, setTitle
296:	Builder alertBuilder = new Builder(context); 
297:	alertBuilder.setTitle(title); 
298:	alertBuilder.setMessage(text); 
299:	alertBuilder.create().show(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: create, setMessage, setNegativeButton, setPositiveButton, setTitle
56:	AlertDialog.Builder builder=new Builder(this); 
57:	builder.setMessage("是否保存新的用户名或密码。"); 
58:	builder.setTitle("温馨提示:"); 
59:	builder.setPositiveButton("保存", new OnClickListener() { 
-
67:	builder.setNegativeButton("不保存", new OnClickListener() { 
-
74:	builder.create().show(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: create, setMessage, setTitle
264:	Builder alertBuilder = new Builder(context); 
265:	alertBuilder.setTitle(title); 
266:	alertBuilder.setMessage(text); 
267:	alertBuilder.create().show(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setMessage, setPositiveButton, setTitle, show
37:	Builder dialog = new AlertDialog.Builder(this); 
38:	dialog.setMessage(message); 
39:	dialog.setPositiveButton("OK", this); 
40:	dialog.setTitle(title); 
41:	dialog.show(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: create, setMessage, setTitle
295:	Builder alertBuilder = new Builder(context); 
296:	alertBuilder.setTitle(title); 
297:	alertBuilder.setMessage(text); 
298:	alertBuilder.create().show(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setItems, setTitle, show
55:	AlertDialog.Builder builder = new Builder(editText.getContext()); 
-
69:	builder.setTitle("Prefix"); 
70:	builder.setItems(prefixes.toArray(new String[prefixes.size()]), 
-
81:	builder.show(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: create, setMessage, setTitle
111:	Builder alertBuilder = new Builder(context); 
112:	alertBuilder.setTitle(title); 
113:	alertBuilder.setMessage(text); 
114:	alertBuilder.create().show(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: create, setMessage, setNegativeButton, setPositiveButton, setTitle
33:	AlertDialog.Builder localBuilder = new AlertDialog.Builder(this); 
34:	localBuilder.setTitle(this.b.getResources().getText(2131428335)); 
-
45:	localBuilder.setMessage(localSpannableStringBuilder); 
46:	localBuilder.setPositiveButton(2131427429, new ado(this)); 
47:	localBuilder.setNegativeButton(2131427399, new adp(this)); 
48:	localBuilder.create().show(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: create, setMessage, setTitle
303:	Builder alertBuilder = new Builder(context); 
304:	alertBuilder.setTitle(title); 
305:	alertBuilder.setMessage(text); 
306:	alertBuilder.create().show(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: create, setMessage, setPositiveButton, setTitle
169:	AlertDialog.Builder builder = new Builder(context); 
170:	builder.setMessage(message); 
171:	builder.setTitle("登录失败!"); 
-
173:	builder.setPositiveButton("确定", 
-
181:	builder.create().show(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: create, setCancelable, setMessage, setNegativeButton, setNeutralButton
66:	Builder builder = new AlertDialog.Builder(context); 
67:	builder.setNeutralButton("Yes", new DialogInterface.OnClickListener() { 
-
82:	builder.setNegativeButton("No", new DialogInterface.OnClickListener() { 
-
87:	builder.setMessage("Select this Stop?"); 
88:	builder.setCancelable(true); 
-
90:	AlertDialog dialog = builder.create(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: create, setMessage, setPositiveButton, setTitle
45:	AlertDialog.Builder localBuilder = new AlertDialog.Builder(localContext); 
46:	localBuilder.setTitle(getString(2131493555)); 
47:	localBuilder.setMessage(2131493556); 
48:	localBuilder.setPositiveButton(2131492965, new v(this, localContext)); 
49:	AlertDialog localAlertDialog = localBuilder.create(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: create, setMessage, setPositiveButton, setTitle
126:	AlertDialog.Builder errOpenDB = new Builder(context); 
127:	errOpenDB.setTitle("Can't open the data!"); 
128:	errOpenDB.setMessage(errString); 
129:	errOpenDB.setPositiveButton("OK", null); 
130:	errOpenDB.create().show(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setCancelable, setNegativeButton, setTitle, show
55:	final AlertDialog.Builder alert = new AlertDialog.Builder(this); 
56:	alert.setTitle(msg); 
57:	alert.setCancelable(true); 
58:	alert.setNegativeButton("Close", 
-
65:	alert.show(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: create, setIcon, setMessage, setPositiveButton, setTitle
74:	AlertDialog.Builder localBuilder = new AlertDialog.Builder(this); 
75:	localBuilder.setTitle(paramString2); 
76:	localBuilder.setMessage(paramString1); 
77:	localBuilder.setIcon(2130837676); 
78:	localBuilder.setPositiveButton(Strings.getString(2131296259), new b(this)); 
79:	this.b = localBuilder.create(); 
Full Snippet Info
6
CodeRank
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: