当前位置: 代码迷 >> Android >> 攻,如何获取AlertDialog的rediobutton值
  详细解决方案

攻,如何获取AlertDialog的rediobutton值

热度:19   发布时间:2016-04-28 03:58:55.0
求助攻,怎么获取AlertDialog的rediobutton值
获取AlertDialog的rediobutton值

比如我现在的默认值为“自动”,在不点击按钮的不出现这个AlertDialog的时候,在外部的textview中获取到默认值。

private String[] huazhi=new String[]{"自动","普通","精细","超精细"};
Dialog log1 = new AlertDialog.Builder(SetActivity.this)
.setSingleChoiceItems(huazhi, 0, new DialogInterface.OnClickListener() 


怎么把这个默认值显示在Acticity中的textview中。




------解决思路----------------------

 public void onClick(DialogInterface dialog,int which)  
{
  if (which > 0 ) { //表示选的是数据
  String tx =    huazhi[which];
TextView t = (TextView) findViewById(mytextid);
  t.setText(tx );
  }

}