google-developer-training / android-basics-kotlin-cupcake-app

Apache License 2.0
103 stars 163 forks source link

Android Basics: Shared ViewModel #79

Closed hebamahdy closed 8 months ago

hebamahdy commented 1 year ago

URL of codelab

In which task and step of the codelab can this issue be found?

  1. Update pickup and summary fragment to use view model

Describe the problem when you call resetOrder in init block it gives null pointer exception because the MutableLiveData

new functions will be fun resetOrder() { _quantity?.value=0 _price?.value=0.0 _flavor?.value="" Log.d("aa",getPickupOptions()[0]) _date?.value?: getPickupOptions()[0] }

Steps to reproduce?

  1. Go to...
  2. Click on...
  3. See error...

Versions Android Studio version: API version of the emulator:

Additional information Include screenshots if they would be useful in clarifying the problem.