 <p>Add below code in your activity.</p> <pre><code>public void Condition(View view) { boolean checked = ((RadioButton) view).isChecked(); switch(view.getId()) { case R.id.newoption: if (checked) break; case R.id.usedoption: if (checked) break; } } </code></pre> <p>and your code should work!</p>