Skip to content

Persist data with Room #208

Description

@rjmacc45-wq

name: Codelab: Read and update data with Room
about: Problem with one item in the codelab
title: Read and update data with Room
labels: ''room database navigate terminate
assignees: ''


URL of codelab:

Specify the language of the codelab if it is not English:

In which task and step of the codelab can this issue be found?
Step 8, deleting items from the database

Describe the problem
In the ItemEditScreen is is possible to press the Delete button to remove a current item. This appears
to succeed but when the navigateBack operation is executed the app returns to the previous screen
with the deleted entry still showing. The app then crashes, and the logcat shows the following error message:
"java.lang.IllegalStateException: The query result was empty, but expected a single row to return a NON-NULL object of type 'com.example.inventory.data.Item'."

Restarting the app shows that the item in question has been correctly deleted.

Steps to reproduce?

  1. Go to... home page, add items if none present
  2. Click on... any item to navigate to the EditDetailsScreen, and press the "Delete" button
  3. See error... as mentioned above in logcat, after the app terminates

Versions
Android Studio version: quail
API version of the emulator: 37.1 (Google Pixel 6a)

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions