A (175)

(Tuis.) #1
505

Chapter 14


Android Content Providers:


Providing Data to Applications


This chapter takes a look at how Android provides content in an application, using what the Android
OS terms a Content Provider. This chapter covers how to share the provided content, as well as
how to access, modify, update, and delete the data that these Content Providers provide. You will
also take a look at some of the Content Providers that come installed with every Android OS.


The topics have become significantly more advanced as you have progressed from one chapter
to the next over the course of this book, and this chapter is no different. Data structure access is
significantly more complex than event handlers or UI design. This is because it involves database
design and, therefore, you need to know how any given database is designed in order to be able to
access its database structure correctly.


For this reason, I am going to provide you with the foundational basics of database design in this
chapter, as I have often done for other core topics in Android, such as user interface design, digital
imaging, 2D animation, digital video, digital audio, Services, threads and processes.


Content Provider (database) usage in Android also involves requesting security permissions for an
application for different types of Content Provider (database) access, such as “read” and “write”
access. As you’re probably surmising by now, since you have been paying close attention during this
book, this is accomplished by using your Android Manifest XML file, and adding in the appropriate
Android child tags.


This chapter begins with a high-level overview of exactly what Android Content Providers are as
well as what they can do for your Android application and its users. After that, you will learn some
foundational information regarding database theory, and learn about the SQLite database used in
Android. Then you will take a look at the various database structures provided with the Android OS,
which you can use with your contact management and new media endeavors, since they have

Free download pdf