You are previewing Android SQLite Essentials.
O'Reilly logo
Android SQLite Essentials

Book Description

Develop Android applications with one of the most widely used database engines, SQLite

In Detail

SQLite is an open source relational database management system. Android uses the SQLite database to store and retrieve data persistently. The driving force behind the platform is the database, enabling a myriad of choices for developers making cutting-edge applications.

Android SQLite Essentials focuses on the core concepts behind building database-driven applications. This book covers the basic and advanced topics with equivalent simplicity and detail, in order to enable readers to quickly grasp and implement the concepts to build an application database.

This book takes a hands-on, example-based approach to help readers understand the core topics of SQLite and Android database-driven applications. This book focuses on providing you with latent as well as widespread knowledge about practices and approaches towards development in an easily understandable manner.

What You Will Learn

  • Design and develop an Android SQLite database architecture
  • Learn the basic principles of a database and include them in your applications
  • Get familiar with Android support classes with examples highlighting their uses
  • Create cutting-edge, database-driven applications in no time
  • Use SQLiteOpenHelper and SQLiteDatabase methods with Android views
  • Make use of ContentProvider to share your data
  • Use Loaders and SimpleCursorAdapter in your applications
  • Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at If you purchased this book elsewhere, you can visit and register to have the files e-mailed directly to you.

    Table of Contents

    1. Android SQLite Essentials
      1. Table of Contents
      2. Android SQLite Essentials
      3. Credits
      4. About the Authors
      5. About the Reviewers
        1. Support files, eBooks, discount offers and more
          1. Why Subscribe?
          2. Free Access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      8. 1. Enter SQLite
        1. Why SQLite?
        2. The SQLite architecture
          1. The SQLite interface
          2. The SQL compiler
          3. The virtual machine
          4. The SQLite backend
        3. A quick review of database fundamentals
          1. What is an SQLite statement?
          2. The SQLite syntax
          3. Datatypes in SQLite
            1. Storage classes
            2. The Boolean datatype
            3. The Date and Time datatype
        4. SQLite in Android
          1. SQLite version
          2. Database packages
            1. APIs
            2. The SQLiteOpenHelper class
            3. The SQLiteDatabase class
            4. ContentValues
            5. Cursor
        5. Summary
      9. 2. Connecting the Dots
        1. Building blocks
        2. A database handler and queries
          1. Building the Create query
          2. Building the Insert query
          3. Building the Delete query
          4. Building the Update query
        3. Connecting the UI and database
        4. Summary
      10. 3. Sharing is Caring
        1. What is a content provider?
          1. Using existing content providers
            1. What is a content resolver?
        2. Creating a content provider
          1. Understanding content URIs
          2. Declaring our contract class
          3. Creating UriMatcher definitions
        3. Implementing the core methods
          1. Initializing the provider through the onCreate() method
          2. Querying records through the query() method
          3. Adding records through the insert() method
          4. Updating records through the update() method
          5. Deleting records through the delete() method
          6. Getting the return type of data through the getType() method
          7. Adding a provider to a manifest
        4. Using a content provider
        5. Summary
      11. 4. Thread Carefully
        1. Loading data with CursorLoader
          1. Loaders
          2. Loader API's summary
          3. Using CursorLoader
        2. Data security
          1. ContentProvider and permissions
          2. Encrypting critical data
        3. General tips and libraries
          1. Upgrading a database
          2. Database minus SQL statements
          3. Shipping with a prepopulated database
        4. Summary
      12. Index