google-developer-training / android-fundamentals-apps-v2

Other
649 stars 2.63k forks source link

Android Kotlin Fundamentals codelab: #291

Closed Sekisback closed 1 year ago

Sekisback commented 3 years ago

Describe the problem May I am wrong but as i learned from this tutorial so far, this peace of code looks useless. Because the "if (checked)" without {} has no function from my point of few

In which lesson and step of the codelab can this issue be found? 04.2 + Task 2 Use radio buttons.

public void onRadioButtonClicked(View view) { // Is the button now checked? boolean checked = ((RadioButton) view).isChecked(); // Check which radio button was clicked. switch (view.getId()) { case R.id.sameday: if (checked) // Same day service displayToast(getString(R.string.same_day_messenger_service)); break;

`