How to check if "Radiobutton" is checked?

android, checked, java, radio-button, selected

Solution

Just as you would with a CheckBox

RadioButton rb;

rb = (RadioButton) findViewById(R.id.rb);

rb.isChecked();

Problem

I would like to make a structure with the condition (if-else) `RadioButton` I want that when the Radiobutton RB1 is selected, this function is active: ``` regAuxiliar = ultimoRegistro; ``` And when the radiobutton RB2 is selected, this function is active: ``` regAuxiliar = objRegistro; ``` And sorry for my English, I'm Brazilian.

Original source

Related problems