Simple question from a begginer

Hi! I’m new to kotlin and android development in generall so my question will be propably silly but I hope that it will make any sense to you.

Currently I’m studying kotlin course made by google and some things presented there aren’t clear for me. In 6th topic of “Shared ViewModel Across Fragments” Module, data binding is being used. They set checked property of radio button based on binding expression in xml file (Screenshot nr 1) and the first question is just why? Checked property is changed automatically for button pressed by user so why do they set it manually for every button? And my second question is about setting on click listeners in xml files with again – binding expressions (Screenshot nr 2). I thought that UI should be separated from logic part and xml file is stricte defining look of our app and nothing more (somewhat like css in web development). Please correct me if I’m wrong and thanks for all answers

https://preview.redd.it/1kh453qzurh71.png?width=752&format=png&auto=webp&s=bcc87025d104e5ebaac7125db44958b0cdfbf0f5

https://preview.redd.it/20yyjuk1vrh71.png?width=746&format=png&auto=webp&s=cf03e5b9312893c01a3a3f09ae012dd3f0a5f8ea

submitted by /u/Ferales15
[link] [comments]