udacity / andfun-kotlin-sleep-tracker-with-recyclerview

Other
102 stars 229 forks source link

A couple questions about Step 9 #13

Closed ghost closed 2 years ago

ghost commented 4 years ago

Hello,

Couldn't find a better place to ask, so might as well do it here.

In step 9, we add data binding to our app. I have two questions about the code here:

1) Why do we use context.resources instead of just resources in BindingUtils.kt lines 45 and 52?

2) In list_item_sleep_night.xml, why do we use, for example, app:sleepImage instead of just sleepImage?

I was not looking at the video while following the audio instructions and for both examples typed in the latter version, yet my app is still working as intended, so I was wondering what the difference there was and why I would want to do it as is provided in the lesson.

SudKul commented 2 years ago

We recommend you use the https://knowledge.udacity.com/ platform to discuss individual issues with our experienced mentors so that new students can benefit from the discussion.