Room DB: Advanced Data Persistence | raywenderlich.com

This tutorial introduces more advanced concepts for use with the Room persistence library, such as migration and indexing.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/5686-room-db-advanced-data-persistence

Should the AppDatabase be a singleton?

@lgleason Can you please help with this when you get a chance? Thank you - much appreciated! :]

Apologies Its actually a mistake of mine. I see it is a singleton through ListMasterApplication. Thanks anyway!

That is correct, it should be a singleton. The reason for that is because spinning up the elements behind Room are expensive. While you could choose not to, you would expend a lot of CPU and memory resources un necessarily doing so which is why Google recommends following a singleton pattern.

This tutorial is more than six months old so questions are no longer supported at the moment for it. Thank you!