如何向用户显示一个对话框,询问他是否要继续,选择是或否?
问问题
1777 次
4 回答
0
Dialog d = new Dialog("Do you want to continue?", new String[]{"Yes","No"}, new int[]{Dialog.OK,Dialog.CANCEL}, Dialog.OK, Bitmap.getPredefinedBitmap(Bitmap.QUESTION)){
public void setChangeListener(FieldChangeListener listener) {
if(d.getSelectedValue() == Dialog.OK){
//true part
}
else{
//false part
}
};
};
d.show();
于 2012-06-04T09:42:40.270 回答
0
您需要使用BB 提供的Dialog
其中一个,例如Dialog.ask(someNumber,"Your message");
于 2011-12-27T10:09:03.923 回答
0
来晚了,但将来可能对某人有所帮助:
int ans = Dialog.ask(Dialog.D_YES_NO, "Do you want to continue?", Dialog.YES);
if (ans == Dialog.YES)
// Continue
else
// Do not Continue
第三个参数表示设置为选项的默认选定Yes
选项。
这是一篇关于如何使用不同类型的 Blackberry 对话框的文章。
于 2013-01-02T07:45:10.880 回答
-3
使用 JOptionPane :
int res = JOptionPane.showConfirmDialog(null,"Do you want to continue ?");
if (int == 0){
// code for continue
}
else {
}
于 2011-03-01T19:27:58.330 回答