关于android对话框 一个例子中的一行代码: AlertDialog dlg = new AlertDialog.Builder(this); 输入后提示错误: Type mismatch: cannot convert from AlertDialog.Builder to AlertDialog 错在什么地方? 怎样写才能声明一个对话框对象? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 AlertDialog dlg = new AlertDialog.Builder(this,Title,Message,事件);如:AlertDialog dialog = new AlertDialog.Builder(this) .setIcon(R.drawable.icon) .setTitle("退出对话框") .setMessage("您真的要退出吗") .setNegativeButton("取消", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }) .setPositiveButton("确定", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { LocalInfoActivity.this.finish(); } }).create(); dialog.show(); 楼主看来不知道java的Builder机制 你应该看看 Builder 返回的是什么 而不是AlertDialog返回的是什么估计LZ是C++ 出生? AlertDialog.Builder adb=new AlertDialog.Builder(this); adb.setTitle("提示"); adb.setMessage("kkkkkkkk"); adb.setIcon(R.drawable.icon); adb.setNegativeButton("取消", null); adb.create().show();楼主用这个!!! 这样写:AlertDialog dlg = new AlertDialog.Builder(this).create();应该就对了 android listview 如何获取asp.net webservice里的数据 android下载文件的问题 输入流为null 请问怎么才能响应TabWidget的每个Tab的长按事件? 求助啊 notification如何多行显示? 有人做过安卓广告sdk开发吗? android 传参的一个小问题 关于android混淆编译和不混淆第三方jar包(新手菜鸟,无嘲笑!)看图 没有DrawerLayout android修改加速度传感器 android + linux下的二个问题 不信难不倒你
AlertDialog dialog = new AlertDialog.Builder(this)
.setIcon(R.drawable.icon)
.setTitle("退出对话框")
.setMessage("您真的要退出吗")
.setNegativeButton("取消",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int which) {
}
})
.setPositiveButton("确定",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int whichButton) {
LocalInfoActivity.this.finish();
}
}).create();
dialog.show();
而不是AlertDialog返回的是什么估计LZ是C++ 出生?
adb.setTitle("提示");
adb.setMessage("kkkkkkkk");
adb.setIcon(R.drawable.icon);
adb.setNegativeButton("取消", null);
adb.create().show();楼主用这个!!!
AlertDialog dlg = new AlertDialog.Builder(this).create();应该就对了