Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

radio button in radiogroup

 
Paul Ngom
Ranch Hand
Posts: 355
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
I am presently encountering a problem with my radio buttons that i have created in my program. The selection of the radio buttons is not unique. If i select one radio button and goes to select another one, the previous one is not unchecked. Its selection is not removed. So i can end with all radio buttons in radiogroup being selected. Can anyone tell me where i am doing it wrong?

the radiogroup as defined in my layout xml file


and the code that creates the radio buttons in my activity class file is as follows:


Help, please!
Kind regards



 
ibrahim yener
Ranch Hand
Posts: 202
Android Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Once i have did something exactly same as your task.
If i find the code i'll post here but so far i remember i made something like following code

 
Paul Ngom
Ranch Hand
Posts: 355
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ibrahim,
I thank you for your quick reply. If i understand your code well. It is supposed to uncheck all the other radio butttons on selection of one in the radiogroup. I thought the radiogroup works in a way such that only one radio button can be checked in the group. I have tried your code as follows but all radio buttons can still be checked.


Any clue?
Kind regards




 
Paul Ngom
Ranch Hand
Posts: 355
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Problem solved. Thanks everybody.
 
ibrahim yener
Ranch Hand
Posts: 202
Android Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Ngom wrote:Problem solved. Thanks everybody.


Dear Paul
Glad to hear your problem solved. If you don't mind could you please post your solution
so, it could be reference for someone else who will have same problem.

Regards
 
Paul Ngom
Ranch Hand
Posts: 355
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I changed the code to look as follows:

So i was told to change the LinearLayout to RadioGroup.
 
rajat jump
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We need RadioButton, RadioGroup and Event listener to make our radio button work. Radio button is present inside radio group.
How to add it?

How to access radio buttons in android?

How to handle click event?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic