android - howto group radio buttons in a custom adapter? -


My question is the same and since I was unable to get a white answer, so I would like to present my question clearly . / P>

I have a custom adapter that takes an array of strings and is to populate the list (defined in my ListActivity class) with that array. Now, each line has a text view in the layout and Reduction is

layout.xml

  & lt ;? Xml version = "1.0" encoding = "UTF-8" & gt; & Lt; RelativeLayout xmlns: Android = "http://schemas.android.com/apk/res/android" Android: layout_width = "match_parent" Android: layout_height = "wrap_content" & gt; & Lt; Android: layout_height = "wrap_content" Android: id = "@ + id / word" Android: textSize = "30px" & gt; TextView android: text = "@ + id / word" Android: layout_width = "wrap_content" & Lt; / TextView & gt; & Lt; Android: layout_marginLeft = "4px" Android: layout_marginRight = "10px" Android: layout_alignParentRight = "true" android: layout_info: layout_alignparentright = "true" android: id = "@ + id / selection" Android: layout_width = "wrap_content" android: layout_height = "wrap_content" X = "27px" Android: layout_a = "8px" & gt; & Lt; / RadioButton & gt;   

Everything is working fine till this point, I am able to present each line with a radiabutan. What I'm looking for is a way in which I can add those radio boots to the same selection. This is necessary for an application that I am creating in which there are answers in the form of four options. Also please tell me whether this is the right approach for such a problem or not. Thanks in advance

I could have been even more clear. Either way, your final assembled XML should look like this. You can do this in code and it's okay, the buildings you are building are refunded as much as they are. Each RadioButton RadioGroup container should fall within the

  & lt; RadioGroup Android. Id = "@ + id / rg_configup1" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" xmlns: Android = "http://schemas.android.com/apk/res/android" Android: orientation = "vertical "Android: layout_centerVertical =" true "android: layout_centerHorizontal =" true "& gt; & Lt; RadioButton android: id = "@ + id / rb_configup1" Android: Layout_width = "Wrap_content" Android: Layout_height = "Wrap_content" android: text = "sales" Android: layout_centerVertical = "true" Android: layout_centerHorizontal = "true" & gt; & Lt; / RadioButton & gt; & Lt; RadioButton android: id = "" @ + id / rb_configup2 Android: Layout_width = "Wrap_content" Android: Layout_height = "Wrap_content" android: text = "regional" Android: layout_above = "@ + id / rb_configup1" Android: layout_alignLeft = "@ + ID / RB_configured 1 "& gt; & Lt; / RadioButton & gt; & Lt; RadioButton android: id = "" @ + id / rb_configup3 Android: Layout_width = "Wrap_content" Android: Layout_height = "Wrap_content" android: text = "Global" Android: layout_above = "@ + id / rb_configup2" Android: layout_alignLeft = "@ + ID / RB_configured 1 "& gt; & Lt; / RadioButton & gt; & Lt; RadioButton android: id = "" @ + id / rb_configup4 Android: Layout_width = "Wrap_content" Android: Layout_height = "Wrap_content" android: text = "ad-hoc" Android: layout_above = "@ + id / rb_configup3" Android: Layout_alignLeft = "@ + Id / rb_configup1 "& gt; & Lt; / RadioButton & gt; & Lt; / RadioGroup & gt;   

Does this make sense or are you trying to do this in something other than XML?

Comments