[android-beginners] Getting text of dynamically created radio buttons

2010-06-18 Thread Maxood
How can i retrieve the text of a dynamically created radio button
selected by the user? Here's my code:

RadioGroup radiogroup = (RadioGroup) findViewById(R.id.rdbGp1);
// layout params to use when adding each radio button
LinearLayout.LayoutParams layoutParams = new
RadioGroup.LayoutParams(
RadioGroup.LayoutParams.WRAP_CONTENT,
RadioGroup.LayoutParams.WRAP_CONTENT);

 for (int i = 0; i  4; i++){
final RadioButton newRadioButton = new RadioButton(this);
c3 = db.getAns(3);

for (int j=0;ji;j++)
c3.moveToNext();
   label = c3.getString(0);

newRadioButton.setText(label);
newRadioButton.setId(6);
radiogroup.addView(newRadioButton, layoutParams);


Waiting for the reply,
Maqsood

-- 
You received this message because you are subscribed to the Google
Groups Android Beginners group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en


Re: [android-beginners] Getting text of dynamically created radio buttons

2010-06-18 Thread Mikey
I have taken a look at the API reference, and getText() looks like it might be 
what you need...

On 18 Jun 2010, at 15:11, Maxood wrote:

 How can i retrieve the text of a dynamically created radio button
 selected by the user? Here's my code:
 
 RadioGroup radiogroup = (RadioGroup) findViewById(R.id.rdbGp1);
// layout params to use when adding each radio button
LinearLayout.LayoutParams layoutParams = new
 RadioGroup.LayoutParams(
RadioGroup.LayoutParams.WRAP_CONTENT,
RadioGroup.LayoutParams.WRAP_CONTENT);
 
 for (int i = 0; i  4; i++){
final RadioButton newRadioButton = new RadioButton(this);
c3 = db.getAns(3);
 
for (int j=0;ji;j++)
c3.moveToNext();
   label = c3.getString(0);
 
newRadioButton.setText(label);
newRadioButton.setId(6);
radiogroup.addView(newRadioButton, layoutParams);
 
 
 Waiting for the reply,
 Maqsood
 
 -- 
 You received this message because you are subscribed to the Google
 Groups Android Beginners group.
 
 NEW! Try asking and tagging your question on Stack Overflow at
 http://stackoverflow.com/questions/tagged/android
 
 To unsubscribe from this group, send email to
 android-beginners+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-beginners?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Beginners group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en