关于android对话框解决方案

关于android对话框
一个例子中的一行代码:

 AlertDialog dlg = new AlertDialog.Builder(this);

 输入后提示错误:

  Type mismatch: cannot convert from AlertDialog.Builder to AlertDialog

 错在什么地方?

  怎样写才能声明一个对话框对象?

------解决方案--------------------
AlertDialog dlg = new AlertDialog.Builder(this,Title,Message,事件);

如:
Java code

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();

楼主用这个!!!