The following is the first few sections of a chapter from The Busy Coder's Guide to Android Development, plus headings for the remaining major sections, to give you an idea about the content of the chapter.


SQLite Databases

Besides SharedPreferences and your own file structures, the third primary means of persisting data locally on Android is via SQLite. For many applications, SQLite is the app’s backbone, whether it is used directly or via some third-party wrapper.

This chapter will focus on how you can directly work with SQLite to store relational data.

Introducing SQLite

SQLite is a very popular embedded database, as it combines a clean SQL interface with a very small memory footprint and decent speed. Moreover, it is public domain, so everyone can use it. Lots of firms (Adobe, Apple, Google, Symbian) and open source projects (Mozilla, PHP, Python) all ship products with SQLite.

For Android, SQLite is “baked into” the Android runtime, so every Android application can create SQLite databases. Since SQLite uses a SQL interface, it is fairly straightforward to use for people with experience in other SQL-based databases. However, its native API is not JDBC, and JDBC might be too much overhead for a memory-limited device like a phone, anyway. Hence, Android programmers have a different API to learn — the good news being is that it is not that difficult.

This chapter will cover the basics of SQLite use in the context of working on Android. It by no means is a thorough coverage of SQLite as a whole. If you want to learn more about SQLite, the SQLite Web site may help.

Thinking About Schemas

The preview of this section is in an invisible, microscopic font.

Start with a Helper

The preview of this section did not survive Thanos's finger snap.

Getting Data Out

The preview of this section will not appear here for a while, due to a time machine mishap.

The Rest of the CRUD

The preview of this section did not survive Thanos's finger snap.

Hey, What About Hibernate?

The preview of this section was eaten by a grue.

But, What About Room?

The preview of this section was abducted by space aliens.

Visit the Trails!

The preview of this section is in the process of being translated from its native Klingon.