Sign in Go Pro

Storing Data in Android with Room

Passing Parameters into a @Query

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson

Up next



In this lesson, we'll describe how to write a Room @Query that accepts parameters.

We want to show the details of a particular task in a Task Details Activity. In order to do this, we'll need to retrieve a task from the database based on its task ID.

Summary of Content:

  • How to select a particular Task from the database based on its primary key
  • How to inject parameters into a Room @Query
  • The syntax required to tell Room that a parameter in the query can be substituted with the function parameter with the same name
  • How and when Room might return null for a query.





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