@Override
protected Dialog onCreateDialog(int id) {
switch (id) {
case IDD_COLOR:
return new AlertDialog(this); // The constructor AlertDialog(context) is not visible
}
return null;
}
为什么?怎么了?
最佳答案
您无法创建 AlertDialog
,因为它具有 protected 构造函数,您可以使用 AlertDialog.Builder
来创建 AlertDialog
。
More information关于这个主题。
关于java - 警报对话框不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4907762/