× Home Tutorials Training Consulting Products Books Company Donate Contact us

Android SQlite and ContentProvider

Get it

This e-Book is available exclusively on Amazon as a Kindle Edition. You can read it on Kindle device and every other modern smartphone and tablet using the Kindle app.


This book demonstrates how you can develop Android applications using the integrated SQLite database.

It also demonstrates how to use and create ContentProvider for accessing data. ContentProviders are Java classes which allow to share data between applications. They also provide a structured interface to access data.

The book assumes that you are already familiar with the Android Development Tools for Eclipse and with creating simple Android applications. The tutorials of this book have been developed and tested with Android 4.0.3, API Level 15.

The first chapter gives an introduction into SQLite and using SQlite on Android.

The second chapter introduces the main SQLite classes and how to use them. It also gives examples how to create and run queries to your database.

The third chapter contains a tutorial in which you create a new Android project which uses SQLite to store its data. In the tutorial you will use a wrapper class (data access object) which handles the access to the database.

In the fourth chapter we look at ContentProviders. It explains what a ContentProvider is, how you can access existing ones and how to define your own one.

In the fifth chapter you also learn how to define a ContentProviders only visible to your application and learn about threading safety with ContentProvider.

The next chapter is a tutorial which shows how to access an existing ContentProvider. You create an Android application which access the data from the "People" application .

The sixth chapter explains the Loader API which was introduced in Android 3.0. Loader loads the data asynchronously. Activities should use this new API to manage their database connection (Cursor).

The seventh chapter is a tutorial in which you create an application to manage your tasks. You create your own ContentProvider for accessing the SQLite database and use the Loader API for accessing and managing the database Cursor.

Accessing the SQLite database directly on the command line is part of the eighth chapter.


Every book has errors/mistakes to a certain degree. You can find a list of the known bugs on the errata page of of this book.

In case you find errors which have not yet been reported, please send an error report by email to: erratabooks@vogella.com .

Errors might be one of the following:
  • Typographical errors
  • Examples that do not work as described in the book
  • Factual errors that are not open to interpretation

Author Background

Lars Vogel Portrait Lars Vogel is the founder and CEO of the vogella GmbH company. He is project lead of the Eclipse platform UI and e4 project, member of the Eclipse PMC and active developer of the Eclipse IDE and RCP framework. He loves to share his knowledge by writing tutorials, books and speaking on software conferences.

For the customers of the vogella GmbH he delivers development, consulting, coaching and training in the areas of Eclipse, Android and Git. These customers include Fortune 100 corporations as well as individual developers.

Lars is a nominated Java Champion since 2012. In 2010 he received the Eclipse Top Contributor Award and in 2012 the Eclipse Top Newcomer Evangelist Award.

Android SQLite cover

vogella Company

Contact us

Email: sales@vogella.com
Call: +49 40 7880 4360