Suppose in my application, i want the user to enter his roll no in a alertDialogbox that appears and then may be another alertDialogbox appears which will ask for his name... If both the enterd values are correct, he is allowed to do a specific task else not. How should i implement it? i tried creating two alertboxes one inside other (i mean, on the click of the ok button), but that did not worked,i got an error message.
final AlertDialog.Builder alert1 = new AlertDialog.Builder(this);
final EditText input = new EditText(this);
alert1.setTitle("Please Enter Roll No");
alert1.setView(input);
alert1.setPositiveButton("Confirm", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
final AlertDialog.Builder alert2 = new AlertDialog.Builder(getBaseContext());
final EditText input1 = new EditText(getBaseContext());
alert2.setTitle("Please Enter Name");
alert2.setView(input1);
alert2.setPositiveButton("Confirm", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
}
});
alert2.setNegativeButton("Cancel",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
dialog.cancel();
}
});
alert2.show();
}
});
alert1.setNegativeButton("Cancel",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
dialog.cancel();
}
});
alert1.show();
How should i achieve it?? if there is some other way also, pl letme know...
Than开发者_Go百科k u!!
I am not sure what you mean by having one 'inside' the other one. You can have the first one pop up and when they press the Enter button it, you can make it trigger the opening of a second one. But in that case the first one is going to close and then the second is going to open it won't be 'inside' of it. Post some of your code and maybe we can help you further with your specific situation.
精彩评论