Day 3: Time Is Money

Or, Keeping a History of Conversions

Today we’ll store history. When a user does a currency conversion, he’s probably on a trip somewhere, and there’s a good chance he won’t have Internet access all the time.

We’ll keep a local record of each conversion the user does, so in the case that he’s offline, he can refer back to the last rate he loaded. It may not be the most up-to-date rate, but chances are it will still be close enough to be useful.

Keeping a History of Conversions

To keep the history of conversions, we’ll write data to a local SQLite database. To do this we’ll need to look at how to reference a database and get it set up the first time it’s used.

Writing History Records

Working with SQLite on Android requires ...

Get Seven Mobile Apps in Seven Weeks 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.