Articles → Android → Radiobutton in android

Radiobutton in android






What is radiobutton?





Radiobutton groups





Click to Enlarge


Example







Click to Enlarge





public void RadioButtonClicked(View view)
{    
      RadioButton radioButton = (RadioButton)view;    
      if(radioButton.isChecked())    
      {        
          if(radioButton.getId() == R.id.maleRadioButton)            
                Toast.makeText(this,"Male Radio Button Clicked", Toast.LENGTH_LONG).show();        
          else if(radioButton.getId() == R.id.femaleRadioButton)            
                Toast.makeText(this,"Female Radio Button Clicked", Toast.LENGTH_LONG).show();    
      }
}



Output



Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Tuesday, November 19, 2019

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250