google-developer-training / basic-android-kotlin-compose-training-inventory-app

Apache License 2.0
77 stars 84 forks source link

Read and update data using Room - Part 8 #35

Open TheXinventor opened 1 year ago

TheXinventor commented 1 year ago

URL of codelab: https://developer.android.com/codelabs/basic-android-kotlin-compose-update-data-room?continue=https%3A%2F%2Fdeveloper.android.com%2Fcourses%2Fpathways%2Fandroid-basics-compose-unit-6-pathway-2%23codelab-https%3A%2F%2Fdeveloper.android.com%2Fcodelabs%2Fbasic-android-kotlin-compose-update-data-room#7

In which task and step of the codelab can this issue be found? 'Populate text fields', step 3

Describe the problem It isn't made clear that the init block needs to be below the itemId definition. Placing it above this definition causes a logic error where the text input fields are not filled in and any changes are not saved

Steps to reproduce?

  1. Go to ui/item/ItemEditViewModel.kt
  2. Cut and paste init block to top of class block
  3. Open app and attempt to edit item
  4. Note that the text input fields are empty
  5. Fill in details and attempt to save
  6. Note that the item details are not updated

Versions Android Studio version: Android Studio Flamingo | 2022.2.1 Patch 2 API version of the emulator: API level 33