| java.lang.Object | |||
| android.app.Dialog | DialogInterface KeyEvent.Callback Window.Callback | ||
| android.app.AlertDialog | DialogInterface | ||
A subclass of Dialog that can display one, two or three buttons. If you only want to display a String in this dialog box, use the setMessage() method. If you want to display a more complex view, look up the FrameLayout called "body" and add your view to it:
FrameLayout fl = (FrameLayout) findViewById(R.id.body); fl.add(myView, new LayoutParams(FILL_PARENT, WRAP_CONTENT));
Nested Classes
Constants inherited
from interface
android.content.DialogInterface
Fields inherited
from class
android.app.Dialog
| AlertDialog(Context context) | |||||
| AlertDialog(Context context, int theme) | |||||
| AlertDialog(Context context, boolean cancelable, Message cancelCallback) | |||||
| AlertDialog(Context context, boolean cancelable, OnCancelListener cancelListener) |
| boolean | onKeyDown(int keyCode, KeyEvent event) | ||||
| A key was pressed down. | |||||
| boolean | onKeyUp(int keyCode, KeyEvent event) | ||||
| A key was released. | |||||
| void | onStart() | ||||
| Called when the dialog is starting. | |||||
| void | setButton(CharSequence text, Message msg) | ||||
| void | setButton(CharSequence text, OnClickListener listener) | ||||
| Set a listener to be invoked when button 1 of the dialog is pressed. | |||||
| void | setButton2(CharSequence text, Message msg) | ||||
| void | setButton2(CharSequence text, OnClickListener listener) | ||||
| Set a listener to be invoked when button 2 of the dialog is pressed. | |||||
| void | setButton3(CharSequence text, OnClickListener listener) | ||||
| Set a listener to be invoked when button 3 of the dialog is pressed. | |||||
| void | setIcon(Drawable icon) | ||||
| void | setIcon(int resId) | ||||
| void | setMessage(CharSequence message) | ||||
| void | setTitle(CharSequence title) | ||||
| Set the title text for this dialog's window. | |||||
| void | setView(View view) | ||||
| Set the view to display in that dialog. | |||||
| static | AlertDialog | show(Context context, CharSequence title, int iconId, CharSequence message, CharSequence button1Text, OnClickListener button1Listener, CharSequence button2Text, OnClickListener button2Listener, CharSequence button3Text, OnClickListener button3Listener, boolean cancelable, OnCancelListener cancelListener) | |||
| Display a simple alert dialog. | |||||
| static | AlertDialog | show(Context context, CharSequence title, int iconId, CharSequence message, CharSequence buttonText, boolean cancelable) | |||
| Display a simple alert dialog. | |||||
| static | AlertDialog | show(Context context, CharSequence title, int iconId, CharSequence message, CharSequence buttonText, OnClickListener buttonListener, boolean cancelable, OnCancelListener cancelListener) | |||
| Display a simple alert dialog. | |||||
| static | AlertDialog | show(Context context, CharSequence title, int iconId, CharSequence message, CharSequence button1Text, OnClickListener button1Listener, CharSequence button2Text, OnClickListener button2Listener, boolean cancelable, OnCancelListener cancelListener) | |||
| Display a simple alert dialog. | |||||
| static | AlertDialog | show(Context context, CharSequence title, Drawable icon, View view, CharSequence buttonText, OnClickListener buttonListener, CharSequence button2Text, OnClickListener button2Listener, CharSequence button3Text, OnClickListener button3Listener, boolean cancelable, OnCancelListener cancelListener) | |||
| Display a simple alert dialog. | |||||
| static | AlertDialog | show(Context context, CharSequence title, int iconId, View view, CharSequence buttonText, OnClickListener buttonListener, CharSequence button2Text, OnClickListener button2Listener, boolean cancelable, OnCancelListener cancelListener) | |||
| Display a simple alert dialog. | |||||
| static | AlertDialog | show(Context context, CharSequence title, int iconId, View view, CharSequence buttonText, OnClickListener buttonListener, CharSequence button2Text, OnClickListener button2Listener, CharSequence button3Text, OnClickListener button3Listener, boolean cancelable, OnCancelListener cancelListener) | |||
| Display a simple alert dialog. | |||||
Methods inherited
from class
android.app.Dialog
Methods inherited
from class
java.lang.Object
Methods inherited
from interface
android.content.DialogInterface
Methods inherited
from interface
android.view.KeyEvent.Callback
Methods inherited
from interface
android.view.Window.Callback
If the focused view didn't want this event, this method is called.
The default implementation handles KEYCODE_BACK to close the dialog.
| text | The text to display in button 1. |
|---|---|
| listener | The DialogInterface.OnClickListener to use. |
| text | The text to display in button 2. |
|---|---|
| listener | The DialogInterface.OnClickListener to use. |
| text | The text to display in button 3. |
|---|---|
| listener | The DialogInterface.OnClickListener to use. |
| title | The new text to display in the title. |
|---|
| context | the context in which this alert is created. |
|---|---|
| title | the title to be shown in the alert, pass null will not show a title |
| iconId | the resourceId of the icon to display next to the title |
| message | the alert message in the alert. |
| button1Text | the text to be shown in the first button, pass null will make the alert buttonless. |
| button1Listener | a DialogInterface.OnClickListener to be called when the first button is clicked |
| button2Text | the text to be shown in the second button, passing null will hide the second button. |
| button2Listener | a DialogInterface.OnClickListener to be notified when the second button is clicked |
| button3Text | the text to be shown in the third button, passing null will hide the second button. |
| button3Listener | a DialogInterface.OnClickListener to be notified when the third button is clicked |
| cancelable | if true, clicking the BACK button will dismiss the alert. |
| cancelListener | if cancelable, this DialogInterface.OnCancelListener's onClick method will be called when the BACK button is clicked. |
| context | the context in which this alert is created. |
|---|---|
| title | the title to be shown in the alert, pass null will not show a title |
| iconId | the resourceId of the icon to display next to the title |
| message | the alert message in the alert. |
| buttonText | the text to be shown in the button, pass null will make the alert buttonless. |
| cancelable | if true, clicking the BACK button will dismiss the alert. |
| context | the context in which this alert is created. |
|---|---|
| title | the title to be shown in the alert, pass null will not show a title |
| iconId | the resourceId of the icon to display next to the title |
| message | the alert message in the alert. |
| buttonText | the text to be shown in the button, pass null will make the alert buttonless. |
| buttonListener | a DialogInterface.OnClickListener to be notified when the button is clicked |
| cancelable | if true, clicking the BACK button will dismiss the alert. |
| cancelListener | if cancelable, this DialogInterface.OnCancelListener's onClick method will be called when the BACK button is clicked. |
| context | the context in which this alert is created. |
|---|---|
| title | the title to be shown in the alert, pass null will not show a title |
| iconId | the resourceId of the icon to display next to the title |
| message | the alert message in the alert. |
| button1Text | the text to be shown in the first button, pass null will make the alert buttonless. |
| button1Listener | a DialogInterface.OnClickListener to be called when the first button is clicked |
| button2Text | the text to be shown in the second button, passing null will hide the second button. |
| button2Listener | a DialogInterface.OnClickListener to be notified when the second button is clicked |
| cancelable | if true, clicking the BACK button will dismiss the alert. |
| cancelListener | if cancelable, this DialogInterface.OnCancelListener's onClick method will be called when the BACK button is clicked. |
| context | the context in which this alert is created. |
|---|---|
| title | the title to be shown in the alert, pass null will not show a title |
| icon | the Drawable to use as the icon to display next to the title |
| view | the view to display in the alert. |
| buttonText | the text to be shown in the button, pass null will make the alert buttonless. |
| buttonListener | a DialogInterface.OnClickListener to be notified when the button is clicked |
| button2Text | the text to be shown in the second button, passing null will hide the second button. |
| button2Listener | a DialogInterface.OnClickListener to be notified when the second button is clicked |
| button3Text | the text to be shown in the third button, passing null will hide the second button. |
| button3Listener | a DialogInterface.OnClickListener to be notified when the third button is clicked |
| cancelable | if true, clicking the BACK button will dismiss the alert. |
| cancelListener | if cancelable, this DialogInterface.OnCancelListener's onClick method will be called when the BACK button is clicked. |
| context | the context in which this alert is created. |
|---|---|
| title | the title to be shown in the alert, pass null will not show a title |
| iconId | the resourceId of the icon to display next to the title |
| view | the view to display in the alert. |
| buttonText | the text to be shown in the button, pass null will make the alert buttonless. |
| buttonListener | a DialogInterface.OnClickListener to be notified when the button is clicked |
| button2Text | the text to be shown in the second button, passing null will hide the second button. |
| button2Listener | a DialogInterface.OnClickListener to be notified when the second button is clicked |
| cancelable | if true, clicking the BACK button will dismiss the alert. |
| cancelListener | if cancelable, this DialogInterface.OnCancelListener's onClick method will be called when the BACK button is clicked. |
| context | the context in which this alert is created. |
|---|---|
| title | the title to be shown in the alert, pass null will not show a title |
| iconId | the resourceId of the icon to display next to the title |
| view | the view to display in the alert. |
| buttonText | the text to be shown in the button, pass null will make the alert buttonless. |
| buttonListener | a DialogInterface.OnClickListener to be notified when the button is clicked |
| button2Text | the text to be shown in the second button, passing null will hide the second button. |
| button2Listener | a DialogInterface.OnClickListener to be notified when the second button is clicked |
| button3Text | the text to be shown in the third button, passing null will hide the second button. |
| button3Listener | a DialogInterface.OnClickListener to be notified when the third button is clicked |
| cancelable | if true, clicking the BACK button will dismiss the alert. |
| cancelListener | if cancelable, this DialogInterface.OnCancelListener's onClick method will be called when the BACK button is clicked. |