builder.setIcon(R.drawable.ic_system) .setTitle("串口号") .setSingleChoiceItems(mPorts, mSelectIndex, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { mSelectIndex = whichButton; tv_mainCtlPort .setText(mPorts[mSelectIndex]); syscfg.setMainCtlPort(mSelectIndex); intent.putExtra(Constant.SYSSETING_STRING, syscfg); SysSettingActivity.this.setResult( Constant.SAVESYSCONFIG, intent); dialog.dismiss(); } }) .setNegativeButton("取消", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { } });
用 DialogInterface.OnClickListener点击事件传的dialog就可以啊,dialog.dismiss();