You are previewing Android Database Programming.
O'Reilly logo
Android Database Programming

Book Description


Applying database concepts to mobile applications is straightforward with this practical tutorial aimed at Google’s Android platform. It will walk you through local and external data storage methods, using clear instructions and practical examples.

  • Master the skills to build data-centric Android applications

  • Go beyond just code by challenging yourself to think about practical use-cases with SQLite and others

  • Focus on flushing out high level design concepts, before drilling down into different code examples

  • In Detail

    We live in an increasingly data-centric and data-driven world. On top of that we live in a very mobile-centric world with the rise of Android smart phones and tablet devices and the surge in demand for the Android platform. Along with the demand for more data, there is a demand for efficient, "snappy" applications, and so developers need to have a strong understanding of when different data storage methods are appropriate and when they are not.

    Mastering how to use these two fields to successfully create a powerful application will help you boost your knowledge and skills in this area.

    "Android Database Programming" is designed to help developers create and design data-centric mobile applications on Google’s Android platform. As the world goes increasingly mobile and as consumers’ demand for data-centric applications rises, knowing how to combine the two effectively will become an increasingly important asset to have as a developer. The book starts by looking at the various local data storage methods on Android, and finishes off by examining external databases and ways you can utilize them from within an Android application.

    This book starts by looking at local data storage methods, focusing on writing SQLite databases for your application and also looking at ways to bind these databases to the user interface. The book, through its practical approach, strives to teach you by examples. Each chapter focuses on flushing out high level design concepts, before drilling down into different code examples.

    As you continue you will look at external databases, primarily Google’s App Engine platform, and pull things together by helping you understand how you can request, cache, and display this data. The book then teaches the ways and techniques to utilize such external databases from within your application.


    Table of Contents

    1. Android Database Programming
      1. Table of Contents
      2. Android Database Programming
      3. Credits
      4. About the Author
      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. Storing Data on Android
        1. Using SharedPreferences
          1. Common use cases for SharedPreferences
            1. Checking if it's the user's first time visit to your application
            2. Checking when the application last updated itself
            3. Remembering what the user's login username was
            4. Remembering an application's state
            5. Caching a user's location
        2. Internal storage methods
        3. External storage methods
        4. SQLite databases
        5. Summary
      9. 2. Using a SQLite Database
        1. Creating advanced SQLite schemas
        2. Wrappers for your SQLite database
        3. Debugging your SQLite database
        4. Summary
      10. 3. SQLite Queries
        1. Methods for building SQLite queries
        2. SELECT statements
        3. WHERE filters and SQL operators
        4. DISTINCT and LIMIT clauses
        5. ORDER BY and GROUP BY clauses
        6. HAVING filters and Aggregate functions
        7. SQL vs. Java performance comparisons
        8. Summary
      11. 4. Using Content Providers
        1. ContentProvider
          1. Implementing the query method
          2. Implementing the delete and update methods
          3. Implementing the insert and getType methods
          4. Interacting with a ContentProvider
        2. Practical use cases
        3. Summary
      12. 5. Querying the Contacts Table
        1. Structure of the Contacts content provider
        2. Querying for Contacts
        3. Modifying Contacts
        4. Setting permissions
        5. Summary
      13. 6. Binding to the UI
        1. SimpleCursorAdapters and ListViews
        2. Custom CursorAdapters
        3. BaseAdapters and Custom BaseAdapters
        4. Handling list interactions
        5. Comparing CursorAdapters and BaseAdapters
        6. Summary
      14. 7. Android Databases in Practice
        1. Local database use cases
        2. Databases as caches
        3. Typical application design
        4. Summary
      15. 8. Exploring External Databases
        1. Different external databases
        2. Google App Engine and JDO databases
        3. GAE: an example with video games
        4. The PersistenceManager and Queries
        5. Summary
      16. 9. Collecting and Storing Data
        1. Methods for collecting data
        2. A primer on web scraping
        3. Extending HTTP servlets for GET/POST methods
        4. Scheduling CRON jobs
        5. Summary
      17. 10. Bringing it Together
        1. Implementing HTTP GET requests
        2. Back to Android: parsing responses
        3. Final steps: binding to the UI (again)
        4. Summary
      18. Index