Android Question CustomListView - RadioButton

Status
Not open for further replies.

WDK

Member
Licensed User
I have a customlistview that includes a radiobutton on each line.

The radiobutton is created in the designer so now I have a problem...

All the radiobuttons are named the same. Is there a way around this so I know which radiobutton is selected? Is there a way to update the tag on a radiobutton created in the designer?

Thanks for any help!
Warren
 

WDK

Member
Licensed User
Erel,

I checked out the example and definitely what I am looking for.

I really appreciate you taking the time to help me out.

Thanks,
WDK
 
Upvote 0

WDK

Member
Licensed User
If I want to change the value of the radio button below, how would I do this?

When I try...
chk.Checked = False

I am getting a error:
java.lang.ClassCastException: android.widget.RadioButton cannot be cast to android.widget.CheckBox


Sub RadioButton1_CheckedChange(Checked As Boolean)
Dim index As Int= clv2.GetItemFromView(Sender)
Dim pnl As Panel = clv2.GetPanel(index)
Dim chk As CheckBox = pnl.GetView(2)
Msgbox($"Item value: ${clv2.GetValue(index)}
Check value: ${chk.Checked}"$, "")
chk.Checked = False
End Sub
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
You want to change a radiobutton but you are trying to access a Checkbox.
B4X:
Dim chk As CheckBox = pnl.GetView(2)
GetView(2) is a Radiobutton, not a Checkbox
 
Upvote 0

Carlos marin

Active Member
Licensed User
Longtime User
I have 5 options with radio button and I need you to select only 1 option but this lets you mark all the radio buttons, how can I solve this?
 
Upvote 0

Carlos marin

Active Member
Licensed User
Longtime User
Are you using check boxes?
Check boxes allows for multiple selection whiles radio button allow s for single selection at a time. Check and make sure you are not using checkboxes

Hi! mcqueccu thanks for answering actually use both but in some options I need the client to select only 1 so I use the radio button, but in this case all radio buttons are selected look at the image
 

Attachments

  • WhatsApp Image 2018-05-11 at 10.41.03 PM.jpeg
    WhatsApp Image 2018-05-11 at 10.41.03 PM.jpeg
    88.1 KB · Views: 326
Upvote 0

mcqueccu

Well-Known Member
Licensed User
Longtime User
Hi! mcqueccu thanks for answering actually use both but in some options I need the client to select only 1 so I use the radio button, but in this case all radio buttons are selected look at the image

Try adding the radiobuttons to a panel
 
Upvote 0
Status
Not open for further replies.
Top