In the Developer.Android example here what does the newRadioButton.setId(R.id.snack); do?
In these examples they use variable names that are suppose to help the learner infer what it does. So why did they choose to call it a snack here?
Did they call it a snack to try to lead me to think of it as a radio hint?
Edit Found out they are calling it a ‘snack’ only because the previous example used food themed variables
I don’t know why they called it snack.
But what the mean with :
newRadioButton.setId(R.id.snack);that they give it an ID.
They made the radiobutton on previousd 2 lines, and when you give it an ID, you can use the radiobutton in the code, for example:
I hope you understand it.
However, I prefer to make buttons in the XML file.