AlertDialog.Builder create()疑惑

AlertDialog.Builder create()疑惑

问题描述:

这样是对的!

 new AlertDialog.Builder(this)
                .setTitle("该词禁止使用")
                .setPositiveButton("ok", null).create().show(); 

这样是对的!

 AlertDialog.Builder builder = new AlertDialog.Builder(this)
                .setTitle("该词禁止使用")
                .setPositiveButton("ok", null);
        builder.create().show();

这样怎么就错了

 AlertDialog.Builder builder = new AlertDialog.Builder(this)
                .setTitle("该词禁止使用")
                .setPositiveButton("ok", null).create().show();

第一种,create()后返回的AlertDialog.Builder对象,可以直接show
第二种,先创建builder 然后是builder调用的show方法
第三种, 你把show返回的内容复制给builder 对象,那肯定就不对了。