Android Database Programming

Android Database Programming
eBook: $23.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $63.98    Print cover: $39.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters
  • 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



Book Details

Language : English
Paperback : 212 pages [ 235mm x 191mm ]
Release Date : June 2012
ISBN : 1849518122
ISBN 13 : 9781849518123
Author(s) : Jason Wei
Topics and Technologies : All Books, Mobile Application Development, Android, Mobile, Open Source

Table of Contents

Chapter 1: Storing Data on Android
Chapter 2: Using a SQLite Database
Chapter 3: SQLite Queries
Chapter 4: Using Content Providers
Chapter 5: Querying the Contacts Table
Chapter 6: Binding to the UI
Chapter 7: Android Databases in Practice
Chapter 8: Exploring External Databases
Chapter 9: Collecting and Storing Data
Chapter 10: Bringing it Together
  • Chapter 1: Storing Data on Android
    • Using SharedPreferences
      • Common use cases for SharedPreferences
        • Checking if it's the user's first time visit to your application
        • Checking when the application last updated itself
        • Remembering what the user's login username was
        • Remembering an application's state
        • Caching a user's location
    • Internal storage methods
    • External storage methods
    • SQLite databases
    • Summary
      • Chapter 3: SQLite Queries
        • Methods for building SQLite queries
        • SELECT statements
        • WHERE filters and SQL operators
        • DISTINCT and LIMIT clauses
        • ORDER BY and GROUP BY clauses
        • HAVING filters and Aggregate functions
        • SQL vs. Java performance comparisons
        • Summary
        • Chapter 4: Using Content Providers
          • ContentProvider
            • Implementing the query method
            • Implementing the delete and update methods
            • Implementing the insert and getType methods
            • Interacting with a ContentProvider
          • Practical use cases
          • Summary
            • Chapter 6: Binding to the UI
              • SimpleCursorAdapters and ListViews
              • Custom CursorAdapters
              • BaseAdapters and Custom BaseAdapters
              • Handling list interactions
              • Comparing CursorAdapters and BaseAdapters
              • Summary

                      Jason Wei

                      Jason Wei graduated from Stanford University in 2011 with a B.S. in Mathematical Computational Science, a minor in Statistics, and an M.S. in Management Science & Engineering with a concentration in Machine Learning. He spent his first two years in college with startups in Silicon Valley, and it was at his second startup (BillShrink, Inc) that he was introduced to Android. Since then he has developed a handful of applications ranging from silly screen prank applications to serious financial pricing and modeling tools. He also enjoys working with APIs and competing in application development contests – winning a number of contests hosted by companies like Google, MyGengo, IndexTank, amongst others. In addition to developing applications, Jason enjoys writing Android tutorials and sharing his own development experiences on his blog (, and it was through his blog that he was first invited to be a technical reviewer for the book Learning Android Game Programming. Jason is currently working as a quantitative trader in New York.

                      Code Downloads

                      Download the code and support files for this book.

                      Submit Errata

                      Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


                      - 1 submitted: last submission 17 Jan 2013

                      Errata type: Typo | Page number: 9

                      The second bullet for the mode argument values should be "MODE_WORLD_WRITABLE" and not "MODE_WORD_WRITABLE". It is WOR[L]D and not WORD


                      Sample chapters

                      You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

                      Frequently bought together

                      Android Database Programming +    Sencha Touch Mobile JavaScript Framework =
                      50% Off
                      the second eBook
                      Price for both: $34.95

                      Buy both these recommended eBooks together and get 50% off the cheapest eBook.

                      What you will learn from this book

                      • Learn about lighter forms of local data storage such as SharedPreferences
                      • Dive into SQLite databases and learn how to customize and extend them
                      • Examine various SQLite queries to efficiently query for your data
                      • Learn to safely expose your SQLite database to external applications
                      • Understand how to bind your SQLite database to the user interface 
                      • Explore various external databases such as Google App Engine and learn how to store/query data on these external platforms
                      • Learn to make network requests to both post and get data from your external data store
                      • Learn to retrieve, parse, and/or cache the incoming web data on the Android application

                      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.



                      This book is a practical tutorial approaching the topic with clear instructions and examples. With easy to understand examples and scenarios you can apply almost anywhere, this book walks you through both local and external data storage methods for the Android platform.

                      Who this book is for

                      "Android Database Programming" targets developers who are experienced with databases and other back-end design concepts, but who may want to see these concepts applied to mobile applications. Developers who are experienced with mobile applications and/or the Android platform, but who may not be as familiar with back-end systems and designing/implementing database schemas will find this tutorial equally useful.

                      Even if you are already experienced with both Android programming and database implementation, but want to further solidify concepts and see a broader scope of data storage methods on Android, this book is your perfect companion.

                      Code Download and Errata
                      Packt Anytime, Anywhere
                      Register Books
                      Print Upgrades
                      eBook Downloads
                      Video Support
                      Contact Us
                      Awards Voting Nominations Previous Winners
                      Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
                      Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software