2
即時創建RadioGroup
,裏面那radio button
。 如何獲取radio button
中的選定值以存儲在數組列表中?Android廣播組
TableLayout ch = (TableLayout) findViewById(R.id.tablechild);
TableRow row2 = new TableRow(Edittextsample.this);
TextView m = new TextView(Edittextsample.this);
m.setText("Meals");
RadioGroup rg2 = new RadioGroup(Edittextsample.this);
rg2.setOrientation(TableLayout.HORIZONTAL);
RadioButton r = new RadioButton(Edittextsample.this)
r.setText("Veg");
r.setTextSize(12);
rg2.addView(r);
RadioButton r1 = new RadioButton(Edittextsample.this)
r1.setText("Non-Veg");
r1.setTextSize(12);
rg2.addView(r);
ch.addView(row2,new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));