Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Radio Button In Android Enable and Disable

Tags:

java

android

I used radio button for language selection.

  • English
  • Hindi
  • Tamil

When I click English the radio button of English should be disabled. Again I should not able to click the English radio button till I click the next language it should be in disabled position. In Java code I need.I created the xml file.

like image 612
Gaddiel technologies Avatar asked Jun 19 '13 11:06

Gaddiel technologies


People also ask

Can radio buttons be disabled?

A disabled Radio Button is un-clickable and unusable. It is a boolean attribute and used to reflect the HTML Disabled attribute. It is usually rendered in grey color by default in all the Browsers.

How do you check radio button is enabled or not?

Using Input Radio checked property: The Input Radio checked property is used to return the checked status of an Input Radio Button. Use document. getElementById('id'). checked method to check whether the element with selected id is check or not.


1 Answers

To enable and Disabled Radio Group write this code.

// To disabled the Radio Buttons of radio group.
        for (int i = 0; i < radioUser.getChildCount(); i++) {
            radioUser.getChildAt(i).setEnabled(false);
        }

where radioUser=RadioGroup

like image 173
Rahul Kushwaha Avatar answered Sep 29 '22 23:09

Rahul Kushwaha