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

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

Android AlertDialog examples from Open Source projects
This code example shows how to use the following methods: setButton, setMessage, setTitle, dismiss, isShowing
66:	if (dialog.isShowing()) { 
67:	dialog.dismiss(); 
-
71:	dialog.setButton(DialogInterface.BUTTON_POSITIVE, 
-
74:	dialog.setTitle(title); 
75:	dialog.setMessage(message); 
76:	dialog.show(); 
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: setTitle, setCancelable, setOnCancelListener, show, setIndeterminate
36:	ProgressDialog progressDialog = new ProgressDialog(context); 
37:	progressDialog.setTitle(title); 
38:	progressDialog.setMessage(message); 
39:	progressDialog.setIndeterminate(indeterminate); 
40:	progressDialog.setCancelable(cancelable); 
41:	progressDialog.setOnCancelListener(onCancelListener); 
42:	progressDialog.show(); 
43:	Robolectric.getShadowApplication().setLatestAlertDialog(shadowOf(progressDialog)); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setTitle, setIndeterminate
29:	ProgressDialog dialog = new ProgressDialog(getActivity()); 
30:	dialog.setIndeterminate(true); 
31:	dialog.setTitle(title); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setTitle, setCancelable, setIndeterminate, setMessage
67:	ProgressDialog dialog = new ProgressDialog(this); 
68:	dialog.setTitle("Indeterminate"); 
69:	dialog.setMessage("Please wait while loading..."); 
70:	dialog.setIndeterminate(true); 
71:	dialog.setCancelable(true); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getWindow, setCancelable, setCanceledOnTouchOutside, show
49:	dialog.setCancelable(true); 
50:	dialog.setCanceledOnTouchOutside(true); 
-
52:	final Window window = dialog.getWindow(); 
-
60:	dialog.show(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setTitle, setCancelable, setOnCancelListener, show, setIndeterminate
88:	ProgressDialog dialog = new ProgressDialog(context); 
89:	dialog.setTitle(title); 
90:	dialog.setMessage(message); 
91:	dialog.setIndeterminate(indeterminate); 
92:	dialog.setCancelable(false); 
-
94:	dialog.setOnCancelListener( new AlixPay.AlixOnCancelListener( (Activity)context ) ); 
-
96:	dialog.show(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setTitle, setCancelable, setIndeterminate, setMessage
37:	final ProgressDialog dialog = new ProgressDialog(getActivity()); 
38:	dialog.setTitle(mTitle); 
39:	dialog.setMessage(mMessage); 
40:	dialog.setIndeterminate(true); 
41:	dialog.setCancelable(false); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setButton, setTitle, show, setProgressStyle
141:	progressDialog   =  new ProgressDialog(context); 
142:	progressDialog.setTitle("Update software"); 
-
144:	progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); 
145:	progressDialog.setButton("Cancel", new OnClickListener() { 
-
155:	progressDialog.show(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setTitle, setCancelable, show
151:	TimePickerDialog tpd = new TimePickerDialog(this.getContext(), this, 
-
153:	tpd.setTitle(this.getTitle()); 
154:	tpd.setCancelable(true); 
155:	tpd.show(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setTitle, setCancelable, setOnCancelListener, show, setIndeterminate
34:	ProgressDialog progressDialog = new ProgressDialog(context); 
35:	progressDialog.setTitle(title); 
36:	progressDialog.setMessage(message); 
37:	progressDialog.setIndeterminate(indeterminate); 
38:	progressDialog.setCancelable(cancelable); 
39:	progressDialog.setOnCancelListener(onCancelListener); 
40:	progressDialog.show(); 
41:	Robolectric.getShadowApplication().setLatestAlertDialog(shadowOf(progressDialog)); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getWindow, setCancelable, setCanceledOnTouchOutside, show
49:	dialog.setCancelable(true); 
50:	dialog.setCanceledOnTouchOutside(true); 
-
52:	final Window window = dialog.getWindow(); 
-
60:	dialog.show(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setButton, setTitle, show, setProgressStyle
141:	progressDialog   =  new ProgressDialog(context); 
142:	progressDialog.setTitle("Update software"); 
-
144:	progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); 
145:	progressDialog.setButton("Cancel", new OnClickListener() { 
-
155:	progressDialog.show(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: dismiss, findViewById, getCurrentFocus, show
93:	int focusId = mDialog.getCurrentFocus().getId(); 
94:	mDialog.dismiss(); 
-
96:	mDialog.show(); 
-
104:	mDialog.findViewById(focusId).requestFocus(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setIcon, setMessage, setTitle, setCancelable, show
49:	new DatePickerDialog(Ch09DateTimeDialog.this, 
-
53:	datePicDlg.setTitle("輸入日期"); 
54:	datePicDlg.setMessage("請輸入日期"); 
55:	datePicDlg.setIcon(android.R.drawable.ic_dialog_info); 
56:	datePicDlg.setCancelable(false); 
57:	datePicDlg.show(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: dismiss, isShowing
112:	if (mPlayListPickerDialog != null && mPlayListPickerDialog.isShowing()) { 
113:	mPlayListPickerDialog.dismiss(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: dismiss
139:	mDialog.dismiss(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setIcon, setTitle, setCancelable, show, setIndeterminate
88:	progressDialog = new ProgressDialog(activity); 
89:	progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); 
90:	progressDialog.setIcon(android.R.drawable.ic_dialog_info); 
91:	progressDialog.setTitle("Carregando..."); 
92:	progressDialog.setMessage("Obtendo palestras, aguarde..."); 
93:	progressDialog.setCancelable(false); 
94:	progressDialog.setIndeterminate(true); 
95:	progressDialog.show(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setIcon, setTitle, setCancelable, setMax, setMessage
20:	mProgressDialog = new ProgressDialog(mContext); 
21:	mProgressDialog.setTitle("Checking dependencies"); 
22:	mProgressDialog.setMessage("Please wait..."); 
23:	mProgressDialog.setCancelable(false); 
24:	mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); 
25:	mProgressDialog.setMax(100); 
26:	mProgressDialog.setIcon(0); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setTitle, setCancelable, show, setMessage, setProgressStyle
29:	mProgress = new ProgressDialog(mContext); 
30:	mProgress.setProgressStyle(ProgressDialog.STYLE_SPINNER); 
31:	mProgress.setTitle(mTitle); 
32:	mProgress.setMessage(mMsg); 
33:	mProgress.setCancelable(false); 
34:	mProgress.show(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setButton, setCancelable, setCanceledOnTouchOutside, show, setIndeterminate
14:	progressDialog = new ProgressDialog(context); 
15:	progressDialog.setIndeterminate(true); 
16:	progressDialog.setCancelable(false); 
17:	progressDialog.setCanceledOnTouchOutside(false); 
18:	progressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, "Cancel", new OnClickListener() { 
-
26:	progressDialog.setMessage(msg); 
27:	progressDialog.show(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: show
64:	DialogRegistration.register(context, alert); 
-
66:	alert.show(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setIcon, setTitle, setCancelable, setMax, setMessage
30:	mProgressDialog = new ProgressDialog(mContext); 
31:	mProgressDialog.setTitle("Stopping server"); 
32:	mProgressDialog.setMessage("Please wait..."); 
33:	mProgressDialog.setCancelable(false); 
34:	mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); 
35:	mProgressDialog.setMax(100); 
36:	mProgressDialog.setIcon(0); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setButton, setMessage, setTitle, show
80:	msgDialog.show(); 
-
86:	msgDialog.setTitle(title); 
87:	msgDialog.setMessage(msg); 
88:	msgDialog.setButton(buttonText, new DialogInterface.OnClickListener(){ 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setTitle, setCancelable, show, setMax, setMessage
54:	dialog = new ProgressDialog(activity); 
55:	dialog.setTitle("Install in progress."); 
56:	dialog.setMessage(msg1); 
57:	dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); 
58:	dialog.setCancelable(false);// ProgressDialog �̃L�����Z�����”\���ǂ��� 
59:	dialog.setMax(100); 
60:	dialog.setProgress(0); 
-
62:	dialog.show(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setButton, setTitle, getWindow, setCancelMessage, setCancelable
57:	dialog = new ProgressDialog(context); 
-
59:	dialog.setTitle(title); 
60:	dialog.setMessage(message); 
-
62:	dialog.setCancelable(true); 
63:	dialog.setCancelMessage(cancelMessage); 
64:	dialog.setButton(DialogInterface.BUTTON_NEGATIVE, context.getResources().getString(android.R.string.cancel), cancelMessage); 
-
66:	dialog.setCancelable(false); 
-
68:	dialog.setProgress(0); 
69:	dialog.setCanceledOnTouchOutside(false); 
70:	dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getButton
578:	applyButtonStyle(ctx, dialog.getButton(DialogInterface.BUTTON1)); 
579:	applyButtonStyle(ctx, dialog.getButton(DialogInterface.BUTTON2)); 
580:	applyButtonStyle(ctx, dialog.getButton(DialogInterface.BUTTON3)); 
581:	applyButtonStyle(ctx, dialog.getButton(DialogInterface.BUTTON_NEGATIVE)); 
582:	applyButtonStyle(ctx, dialog.getButton(DialogInterface.BUTTON_NEUTRAL)); 
583:	applyButtonStyle(ctx, dialog.getButton(DialogInterface.BUTTON_POSITIVE)); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setIcon, setTitle, setCancelable, setMax, setMessage
22:	mProgressDialog = new ProgressDialog(mContext); 
23:	mProgressDialog.setTitle("Removing Dropbear"); 
24:	mProgressDialog.setMessage("Please wait..."); 
25:	mProgressDialog.setCancelable(false); 
26:	mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); 
27:	mProgressDialog.setMax(100); 
28:	mProgressDialog.setIcon(0); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setTitle, setCancelable, setOnCancelListener, setIndeterminate, setMessage
21:	ProgressDialog progressdialog = new ProgressDialog(context, j); 
-
28:	progressdialog.setTitle(((CharSequence) (obj))); 
-
33:	progressdialog.setMessage(((CharSequence) (obj1))); 
34:	progressdialog.setIndeterminate(true); 
35:	progressdialog.setCancelable(flag); 
36:	progressdialog.setOnCancelListener(null); 
-
58:	mDialog.setOnCancelListener(new android.content.DialogInterface.OnCancelListener() { 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: show
57:	alertDialog.show(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setMessage, show
185:	mOptionNoteDialog.setMessage( mOptions[item] ); 
186:	mOptionNoteDialog.show(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: dismiss
139:	mAlertDialog.dismiss(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setButton
66:	final DatePickerDialog picker = new DatePickerDialog(getActivity(), getConstructorListener(), year, month, day); 
-
70:	picker.setButton(DialogInterface.BUTTON_POSITIVE, getActivity().getString(android.R.string.ok), 
71:	new DialogInterface.OnClickListener() 
-
80:	picker.setButton(DialogInterface.BUTTON_NEGATIVE, getActivity().getString(android.R.string.cancel), 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setTitle, setCancelable, setOnCancelListener, show, setIndeterminate
91:	ProgressDialog dialog = new ProgressDialog(context); 
92:	dialog.setTitle(title); 
93:	dialog.setMessage(message); 
94:	dialog.setIndeterminate(indeterminate); 
95:	dialog.setCancelable(false); 
-
97:	dialog.setOnCancelListener( new SampleActivity.AlixOnCancelListener( (Activity)context ) ); 
-
99:	dialog.show(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getListView, show
81:	dialog.getListView().setOnItemLongClickListener( longClickListener ); 
82:	dialog.show(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setTitle, show, setIndeterminate, setProgressStyle
20:	progressDialog = new ProgressDialog(view); 
21:	progressDialog.setTitle("���ǃ��X�g�擾��"); 
22:	progressDialog.setIndeterminate(false); 
23:	progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); 
24:	progressDialog.show(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: dismiss
245:	mDialog.dismiss(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getButton, getWindow
100:	mDialog.getWindow() 
-
103:	mDialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setTitle, show, setIndeterminate, setProgressStyle
21:	progressDialog = new ProgressDialog(view); 
22:	progressDialog.setTitle("�t�B�[�h�Ǎ���"); 
23:	progressDialog.setIndeterminate(false); 
24:	progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); 
25:	progressDialog.show(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setIcon, setTitle, setCancelable, setMax, setMessage
26:	mProgressDialog = new ProgressDialog(mContext); 
27:	mProgressDialog.setTitle("Installing Dropbear"); 
28:	mProgressDialog.setMessage("Please wait..."); 
29:	mProgressDialog.setCancelable(false); 
30:	mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); 
31:	mProgressDialog.setMax(100); 
32:	mProgressDialog.setIcon(0); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setTitle, setIndeterminate, setIndeterminateDrawable, setMessage
90:	final ProgressDialog dialog = new ProgressDialog(getActivity()); 
91:	dialog.setIndeterminate(true); 
92:	dialog.setIndeterminateDrawable(null); 
93:	dialog.setTitle(mTitle); 
94:	dialog.setMessage(mMessage); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setMessage, setTitle, show
77:	mDialog.setTitle(title); 
78:	mDialog.setMessage(getText(message)); 
79:	mDialog.show(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setTitle, setCancelable, setCanceledOnTouchOutside, show, setMessage
170:	progress = new ProgressDialog(TweetsActivity.this); 
171:	progress.setTitle(""); 
172:	progress.setMessage("Downloading your timeline..."); 
173:	progress.setCanceledOnTouchOutside(false); 
174:	progress.setCancelable(false); 
175:	progress.show(); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setTitle, show, setMax, setMessage
139:	mProgress.setTitle( b.getString("title") ); 
140:	mProgress.setMessage( b.getString("message") ); 
141:	mProgress.setMax( b.getInt("max") ); 
142:	mProgress.show(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setTitle, setCancelable, setIndeterminate, setMax, setProgressStyle
21:	final ProgressDialog dialog = new ProgressDialog(getActivity()); 
22:	dialog.setTitle("Hetk..."); 
23:	dialog.setIndeterminate(false); 
24:	dialog.setCancelable(false); 
25:	dialog.setMax(max); 
26:	dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setCanceledOnTouchOutside, show
150:	dialog.setCanceledOnTouchOutside(true); 
151:	dialog.show(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setTitle, setCancelable, show, setMax, setMessage
152:	progressDialog.setMax(totalNumberOfPackages); 
153:	progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); 
154:	progressDialog.setTitle("Loading data"); 
155:	progressDialog.setMessage("Please wait..."); 
156:	progressDialog.setCancelable(false); 
157:	progressDialog.show(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setTitle, setCancelable, setCanceledOnTouchOutside, setIndeterminate, setMax
35:	final ProgressDialog dialog = new ProgressDialog(getActivity()); 
36:	dialog.setTitle(((DeterminateProgressDialogListener) getActivity()).getDeterminateDialogMessage()); 
37:	dialog.setIndeterminate(false); 
38:	dialog.setCancelable(true); 
39:	dialog.setCanceledOnTouchOutside(true); 
40:	dialog.setMax(100); 
41:	dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); 
42:	dialog.setProgress(0); 
Full Snippet Info
6
CodeRank
Related Android AlertDialog Questions & Answers:
Other Android AlertDialog Examples
0:	AlertDialog alertDialog = new AlertDialog.Builder(
1:							AlertDialogActivity.this).create();
2:

Read More

7:				// device doesn't support flash
8:				// Show alert message and close the application
9:				AlertDialog alert = new AlertDialog.Builder(MainActivity.this)
10:						.create();
11:				alert.setTitle("Error");

Read More

17:		public void showAlertDialog(Context context, String title, String message,
18:				Boolean status) {
19:			AlertDialog alertDialog = new AlertDialog.Builder(context).create();
20:	
21:			// Setting Dialog Title

Read More

See Code Examples for Android AlertDialog Methods: