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

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