问题描述
获取AlertDialog的rediobutton值
比如我现在的默认值为“自动”,在不点击按钮的不出现这个AlertDialog的时候,在外部的textview中获取到默认值。
private String[] huazhi=new String[]{"自动","普通","精细","超精细"};
Dialog log1 = new AlertDialog.Builder(SetActivity.this)
.setSingleChoiceItems(huazhi, 0, new DialogInterface.OnClickListener()
怎么把这个默认值显示在Acticity中的textview中。
解决方案1
public void onClick(DialogInterface dialog,int which)
{
if (which > 0 ) { //表示选的是数据
String tx = huazhi[which];
TextView t = (TextView) findViewById(mytextid);
t.setText(tx );
}
}
求助攻,怎么获取AlertDialog的rediobutton值
原文:http://www.cnblogs.com/lengyanyue39/p/4027487.html