当我创建两个对话框时,即使另一个对话框的条件为真,也只显示一个..
这是代码
if (z<=18){
showDialog(1);
} else {
showDialog(3);
}
...................................................................................................................................................................
protected Dialog onCreateDialog(int id)
{
if (id== 1)
{
AlertDialog.Builder b=new AlertDialog.Builder(this);
b.setTitle("1st dialog");
b.setPositiveButton("OK",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
}
});
AlertDialog d=b.create();
d.show();
}
else
{
AlertDialog.Builder b2=new AlertDialog.Builder(this);
b2.setTitle("2nd dialog ");
b2.setPositiveButton("OK",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
}
});
AlertDialog dialoog=b2.create();
dialoog.show();
}
return super.onCreateDialog(id);
}