O'Reilly logo

Android Application Development For Dummies, 2nd Edition by Donn Felker, Michael Burton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Resolving ContentProvider URLs

An Android ContentProvider uses URLs to identify data. Typically, you can use a URL to identify a specific piece of data, such as a single reminder, or all reminders in your database. If you store other types of data there, you can use URLs for them, too.

In your application, you use two kinds of URLs — content://com.dummies.android.taskreminder.ReminderProvider/reminder to retrieve a list of all reminders in your database or content://com.dummies.android.taskreminder.ReminderProvider/reminder/9 to retrieve a specific reminder from the database (in this case the reminder with the ID of 9).

These content provider URLs are undoubtedly similar to the URLs you’re already familiar with. Their main differences are described in this list:

check.png content://: A ContentProvider begins with content:// rather than with http://.

check.png com.dummies.android.taskreminder.ReminderProvider: The second part of the URL identifies the authority (the ReminderProvider ContentProvider) of the content. Though this string can be virtually anything, convention dictates using the fully qualified name of your ContentProvider.

check.png reminder: The third part of the URL identifies the path — in this case, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required