• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

radio button in radiogroup

 
Ranch Hand
Posts: 355
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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



 
Ranch Hand
Posts: 202
Android PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Problem solved. Thanks everybody.
 
ibrahim yener
Ranch Hand
Posts: 202
Android PHP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I changed the code to look as follows:

So i was told to change the LinearLayout to RadioGroup.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic