求助攻,怎么获取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中。



解决方案1

 public void onClick(DialogInterface dialog,int which)  

{

  if (which > 0 ) { //表示选的是数据

  String tx =    huazhi[which];

TextView t = (TextView) findViewById(mytextid);

  t.setText(tx );

  }



}

posted @ 2014-10-15 22:01  0基础学android开发  阅读(218)  评论(0编辑  收藏  举报
我要啦免费统计