我做了一个包含单选按钮的布局。我想将选定单选按钮的值传递给数据库,那么我怎样才能得到这个值。?代码如下..请帮助我..
private View drawRadioTypeQuestion(Question question, ArrayList<QuestionOption> questionOptions) {
LinearLayout layout = new LinearLayout(this);
layout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
layout.setOrientation(LinearLayout.VERTICAL);
layout.setPadding(5, 5, 5, 5);
TextView tv = new TextView(this);
tv.setText(question.Question_Order + ". " + question.Question_Title);
tv.setTextSize(16);
// tv.setTypeface(PhoneStatus.getRobotoMediumTypeface(this));
layout.addView(tv);
RadioGroup rg = new RadioGroup(this);
rg.setOrientation(RadioGroup.VERTICAL);
for (QuestionOption opt : questionOptions) {
RadioButton rb = new RadioButton(this);
rb.setText(opt.Question_Answer_Value);
rb.setTextSize(16);
rg.addView(rb);
}
layout.addView(rg);
PhoneStatus.overrideFonts(QuestionListActivity.this, layout);
tv.setTypeface(PhoneStatus.getRobotoMediumTypeface(this));
return layout;
}