Allowance overview with a Room database

If you run the overview screen and add a few claims to it, you'll notice that one piece of the code isn't reacting to the new items being added to the database: the allowance overview at the top of the screen. This is because while everything else is connected to the Room database, it's still watching the Allowance data model. Using a data model like this is a good idea when the data is just in memory, but now that you have a database in place, things can change and simplify. For example, the Allowance class only really keeps how much the user plans to spend each day; the claim items can actually be seen as an entirely separate structure in the database model.

As such, you can move the daily allowance ...

Get Hands-On Android UI Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.