如何让alertdialog选择完后自动关闭
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();
posted on 2014-04-18 10:52 strangeman 阅读(1236) 评论(0) 编辑 收藏 举报