Book Image

Android SQLite Essentials

By : Sunny Kumar Aditya, Vikash Kumar Karn
Book Image

Android SQLite Essentials

By: Sunny Kumar Aditya, Vikash Kumar Karn

Overview of this book

<p>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.</p> <p>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.</p> <p>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.</p>
Table of Contents (11 chapters)

Creating a content provider


A content provider provides access to data in two ways: one is structured data that goes in the form of a database, as the example we are working on currently, or in the form of file data, that is, data that goes in the form of pictures, audio, video, and so on stored in the private space of the application. Before we begin digging into how to create a content provider, we should also retrospect whether we need one. If we want to offer data to other applications, allow users to copy data from our app to another, or use the search framework in our application, then the answer is yes.

Just like other Android components (Activity, Service, or BroadcastReceiver), a content provider is created by extending the ContentProvider class. Since ContentProvider is an abstract class, we have to implement the six abstract methods. These methods are as follows:

Method

Usage

void onCreate()

Initializes the provider

String getType(Uri)

Returns the MIME type of data in...