码迷,mamicode.com
首页 > 其他好文 > 详细

求助攻,怎么获取AlertDialog的rediobutton值

时间:2014-10-16 00:43:31      阅读:202      评论:0      收藏:0      [点我收藏+]

标签:io   java   sp   数据   on   问题   cti   log   bs   

问题描述
获取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值

标签:io   java   sp   数据   on   问题   cti   log   bs   

原文地址:http://www.cnblogs.com/lengyanyue39/p/4027487.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!