jeudi 22 octobre 2015

The app crash when I control if box is checked

I learning Android and i'm testing the buttons. Now i'm testing RadioButton, and I want to control if the button is cheked or not, i know that the correct stament is "rb.isChecked()", but when i use it, my app crash.

This is the code:

RadioButton rb;
TextView tv = (TextView) findViewById(R.id.textViewPPlat);
rb = (RadioButton) findViewById(R.id.radioButton);
if(rb.isChecked())
{
    tv.setText("20EUR");
}




Aucun commentaire:

Enregistrer un commentaire