|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectandroid.app.Dialog
android.app.AlertDialog
public class AlertDialog
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 Class Summary | |
|---|---|
static class |
AlertDialog.Builder
|
| Nested classes/interfaces inherited from interface android.content.DialogInterface |
|---|
DialogInterface.OnCancelListener, DialogInterface.OnClickListener, DialogInterface.OnDismissListener, DialogInterface.OnKeyListener, DialogInterface.OnMultiChoiceClickListener |
| Field Summary |
|---|
| Fields inherited from class android.app.Dialog |
|---|
mCancelable, mContext, mDecor, mWindow, mWindowManager |
| Fields inherited from interface android.content.DialogInterface |
|---|
BUTTON1, BUTTON2, BUTTON3 |
| Constructor Summary | |
|---|---|
protected |
AlertDialog(Context context)
|
protected |
AlertDialog(Context context,
boolean cancelable,
DialogInterface.OnCancelListener cancelListener)
|
protected |
AlertDialog(Context context,
int theme)
|
| Method Summary | |
|---|---|
protected void |
onCreate(Bundle savedInstanceState)
Similar to Activity.onCreate(android.os.Bundle), you should initialized your dialog
in this method, including calling Dialog.setContentView(int). |
boolean |
onKeyDown(int keyCode,
KeyEvent event)
A key was pressed down. |
boolean |
onKeyUp(int keyCode,
KeyEvent event)
A key was released. |
void |
setButton(CharSequence text,
DialogInterface.OnClickListener listener)
Set a listener to be invoked when button 1 of the dialog is pressed. |
void |
setButton(CharSequence text,
Message msg)
|
void |
setButton2(CharSequence text,
DialogInterface.OnClickListener listener)
Set a listener to be invoked when button 2 of the dialog is pressed. |
void |
setButton2(CharSequence text,
Message msg)
|
void |
setButton3(CharSequence text,
DialogInterface.OnClickListener listener)
Set a listener to be invoked when button 3 of the dialog is pressed. |
void |
setButton3(CharSequence text,
Message msg)
|
void |
setCustomTitle(View customTitleView)
|
void |
setIcon(Drawable icon)
|
void |
setIcon(int resId)
Set resId to 0 if you don't want an icon. |
void |
setInverseBackgroundForced(boolean forceInverseBackground)
|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface android.content.DialogInterface |
|---|
cancel, dismiss |
| Constructor Detail |
|---|
protected AlertDialog(Context context)
protected AlertDialog(Context context,
int theme)
protected AlertDialog(Context context,
boolean cancelable,
DialogInterface.OnCancelListener cancelListener)
| Method Detail |
|---|
public void setTitle(CharSequence title)
Dialog
setTitle in class Dialogtitle - The new text to display in the title.public void setCustomTitle(View customTitleView)
AlertDialog.Builder.setCustomTitle(View)public void setMessage(CharSequence message)
public void setView(View view)
public void setButton(CharSequence text,
Message msg)
public void setButton2(CharSequence text,
Message msg)
public void setButton3(CharSequence text,
Message msg)
public void setButton(CharSequence text,
DialogInterface.OnClickListener listener)
text - The text to display in button 1.listener - The DialogInterface.OnClickListener to use.
public void setButton2(CharSequence text,
DialogInterface.OnClickListener listener)
text - The text to display in button 2.listener - The DialogInterface.OnClickListener to use.
public void setButton3(CharSequence text,
DialogInterface.OnClickListener listener)
text - The text to display in button 3.listener - The DialogInterface.OnClickListener to use.public void setIcon(int resId)
resId - the resourceId of the drawable to use as the icon or 0
if you don't want an icon.public void setIcon(Drawable icon)
public void setInverseBackgroundForced(boolean forceInverseBackground)
protected void onCreate(Bundle savedInstanceState)
DialogActivity.onCreate(android.os.Bundle), you should initialized your dialog
in this method, including calling Dialog.setContentView(int).
onCreate in class DialogsavedInstanceState - If this dialog is being reinitalized after a
the hosting activity was previously shut down, holds the result from
the most recent call to Dialog.onSaveInstanceState(), or null if this
is the first time.
public boolean onKeyDown(int keyCode,
KeyEvent event)
DialogIf the focused view didn't want this event, this method is called.
The default implementation handles KEYCODE_BACK to close the dialog.
onKeyDown in interface KeyEvent.CallbackonKeyDown in class DialogkeyCode - The value in event.getKeyCode().event - Description of the key event.
Dialog.onKeyUp(int, android.view.KeyEvent),
KeyEvent
public boolean onKeyUp(int keyCode,
KeyEvent event)
Dialog
onKeyUp in interface KeyEvent.CallbackonKeyUp in class DialogkeyCode - The value in event.getKeyCode().event - Description of the key event.
Dialog.onKeyDown(int, android.view.KeyEvent),
KeyEvent
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||