New dialog sample with a lot of text and thus large dialog.

Change-Id: Iaf0cba52e51f36b98a5a4a1965f0e1eb02bb8f9f
This commit is contained in:
Dianne Hackborn
2010-11-29 16:51:47 -08:00
parent 02cdaff475
commit e06aa608ab
3 changed files with 76 additions and 0 deletions

View File

@@ -64,6 +64,7 @@ public class AlertDialogSamples extends Activity {
private static final int DIALOG_MULTIPLE_CHOICE = 6;
private static final int DIALOG_TEXT_ENTRY = 7;
private static final int DIALOG_MULTIPLE_CHOICE_CURSOR = 8;
private static final int DIALOG_YES_NO_ULTRA_LONG_MESSAGE = 9;
private static final int MAX_PROGRESS = 100;
@@ -115,6 +116,30 @@ public class AlertDialogSamples extends Activity {
}
})
.create();
case DIALOG_YES_NO_ULTRA_LONG_MESSAGE:
return new AlertDialog.Builder(AlertDialogSamples.this)
.setIcon(R.drawable.alert_dialog_icon)
.setTitle(R.string.alert_dialog_two_buttons_msg)
.setMessage(R.string.alert_dialog_two_buttons2ultra_msg)
.setPositiveButton(R.string.alert_dialog_ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
/* User clicked OK so do some stuff */
}
})
.setNeutralButton(R.string.alert_dialog_something, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
/* User clicked Something so do some stuff */
}
})
.setNegativeButton(R.string.alert_dialog_cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
/* User clicked Cancel so do some stuff */
}
})
.create();
case DIALOG_LIST:
return new AlertDialog.Builder(AlertDialogSamples.this)
.setTitle(R.string.select_dialog)
@@ -277,6 +302,15 @@ public class AlertDialogSamples extends Activity {
});
/* Display an ultra long text message with yes/no buttons and handle each message as well as the cancel action */
Button twoButtons2UltraTitle = (Button) findViewById(R.id.two_buttons2ultra);
twoButtons2UltraTitle.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
showDialog(DIALOG_YES_NO_ULTRA_LONG_MESSAGE);
}
});
/* Display a list of items */
Button selectButton = (Button) findViewById(R.id.select_button);
selectButton.setOnClickListener(new OnClickListener() {