Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

radio group get selected value android kotlin

fun getSelected() {
	val radioGroup = findViewById<RadioGroup>(R.id.rgColors)
    val color = when(radioGroup.checkedRadioButtonId) {
    	R.id.rbBlue -> "Blue"
        R.id.rbGreen -> "Green"
        R.id.rbRed -> "Red"
        else -> "Other
    }
}
Comment

how to get data from radio group in android

  // get selected radio button from radioGroup
            int selectedId = radioGroup.getCheckedRadioButtonId();

            // find the radiobutton by returned id
            radioButton = (RadioButton) findViewById(selectedId);

            Toast.makeText(MyAndroidAppActivity.this,
                radioButton.getText(), Toast.LENGTH_SHORT).show();
Comment

android studio get selected radio button

int radioButtonID = radioButtonGroup.getCheckedRadioButtonId();
View radioButton = radioButtonGroup.findViewById(radioButtonID);
int idx = radioButtonGroup.indexOfChild(radioButton);
Comment

radiogroup get selected item android

int radioButtonID = radioButtonGroup.getCheckedRadioButtonId();
View radioButton = radioButtonGroup.findViewById(radioButtonID);
Comment

PREVIOUS NEXT
Code Example
Java :: java 2d jagged array example 
Java :: java random number generator 
Java :: sort java array 
Java :: how to change datatypes in java 
Java :: Java empty() Method 
Java :: java check array for duplicates 
Java :: string array to string stream java 
Java :: kotlin spinner default value 
Java :: set style programmatically android 
Java :: why are string immutsble in java 
Java :: how to convert double to int in java 
Java :: string to char array 
Java :: input arraylist in java 
Java :: Java Create a Scanner Object in Java 
Java :: what is construct in java 
Java :: Java Add elements to a HashMap 
Java :: convert json to xml in java 
Java :: loops in java 
Java :: spring swagger ui login oauth2 
Java :: Error: Could not find or load main class Hello Caused by: java.lang.ClassNotFoundException: Hello studio visual code 
Java :: java replaceall single character 
Java :: types of exception in java 
Java :: Java float Keyword 
Java :: java crypto ke random 
Java :: multiple inputs java 
Java :: print 1 to 10 using for loop in java 
Java :: access char in string 
Java :: MOST COMPLEX NAME OF CONSUMER 
Java :: split email on dot java 
Java :: hgjhghj 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =