Sign in Go Pro

Storing Data in Android with Room

Deleting entities using the @Delete annotation

11/13/2018

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson
Autoplay

Up next

Previous

About

In this lesson, we'll describe how to delete entities from a Room database using the @Delete annotation.

We'll show how @Delete can be used to delete tasks from our database.

We'll also show what the equivalent full SQLite @Query would look like. This will highlight how much less code is required to delete an entity when using the @Delete annotation.

Summary of Content:

  • Defining a function which uses @Delete annotation
  • How to provide the task to be deleted
  • What the equivalent full deletion SQL query would be if using @Query
  • When you might prefer to use the full @Query approach instead of @Delete
  • What happens to LiveData<Task> observer when the observed entity is deleted
  • What happens to LiveData<List<Task>> observer when a task is deleted from the task list

Links:

Instructor

Links

Comments

There are no comments on this lesson, start the conversation below ...

>
You need to go PRO to post comments.

Lessons in Storing Data in Android with Room