Sign in Go Pro

Storing Data in Android with Room


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 discuss what TypeConverters are, and describe when you might need to use them.

We'll add a new field to an entity, one with a data type that Room doesn't know how to persist. We'll see the error Room provides here, and walk you through how to add a TypeConverter to fix the problem.

Summary of Content:

  • What data types Room knows how to store
  • How to tell Room how to store complex objects, such as classes you've defined yourself
  • What a TypeConverter is, and how to define a function using the TypeConverter annotation
  • How to register a TypeConverter with Room, using the @TypeConverters annotation
  • What options you have for applying scope to a TypeConverter
  • When you'll see this error, and how to fix it. "Cannot figure out how to save this field into database. You can consider adding a type converter for it."
  • Writing type converters to allow us to persist a field of type Date to the database





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


Lessons in Storing Data in Android with Room