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

Other
102 stars 229 forks source link

Step-12 App Crashes after uncommenting the code. #23

Closed tusharjha44 closed 2 years ago

tusharjha44 commented 2 years ago

After debugging it , I found that in ImageView app:sleepImage="@{sleepDtailViewModel.night} is responsible for app crash. If anyone know any solution please help me.

adityadav23 commented 2 years ago

same issue

adityadav23 commented 2 years ago

@tusharjha44

version_core = "1.3.1" version_coroutine = "1.3.7" version_navigation = '1.0.0' version_constraint_layout = "2.0.0-rc1" version_gradle = '4.0.1' version_kotlin = "1.3.72" version_lifecycle_extensions = "2.2.0" version_lifecycle = "2.2.0" version_room = "2.2.5" version_appcompat = "1.2.0" version_fragment = "1.0.0"

I couldn't find any version which is 1.6.0 could you help me here

adityadav23 commented 2 years ago

@tusharjha44 sent you request over linkedin, Could you connect with me there?

nishatoma commented 2 years ago

Hi @tusharjha44 @adityadav23 , did you end up figuring out why it was crashing?

nishatoma commented 2 years ago

fun ImageView.setSleepImage(item: SleepNight?){ item?.let { setImageResource(when (item.sleepQuality) { 0 -> R.drawable.ic_sleep_0 1 -> R.drawable.ic_sleep_1 2 -> R.drawable.ic_sleep_2 3 -> R.drawable.ic_sleep_3 4 -> R.drawable.ic_sleep_4 5 -> R.drawable.ic_sleep_5 else -> R.drawable.ic_sleep_active }) } }

I just had to add '?' to my SleepNight that was passed in!