Grokking Android

Getting Down to the Nitty Gritty of Android Development

Posts tagged “ContentProvider”:

Handling Binary Data with ContentProviders

By

To share binary data across app boundaries Android’s programming model expects you to use content providers. And while I have covered how to access content providers and how to code one yourself, I haven’t covered how to deal with binary data. I am going to correct that in this post. How to access binary data […]  Continue Reading  “Handling Binary Data with ContentProviders”

Android’s ContentProviderOperation: “withYieldAllowed” explained

By

Whenever you use a ContentProviderOperation and have to insert, update or delete many records, the method withYieldAllowed() comes in handy. Normally the batch job would be executed in one transaction that spans all operations. But if your job contains many manipulations, the transaction might last quite a while and it might block other tasks from […]  Continue Reading  “Android’s ContentProviderOperation: “withYieldAllowed” explained”

Android’s ContentProviderOperation: “withBackReference” explained

By

The class ContentProviderOperation.Builder has a method named withValueBackReference(String key, int previousResult). The API states ominously “Add a ContentValues back reference. A column value from the back references takes precedence over a value specified in withValues(ContentValues)”. Now, thank you, Google! That about explains everything! Android’s documentation is never short of surprises. A lot of stuff is […]  Continue Reading  “Android’s ContentProviderOperation: “withBackReference” explained”

Android Tutorial: Writing your own Content Provider

By

This is the last part of a three part tutorial on content providers. In this post I am going to show you how to write your own content provider. I covered the common concepts of content providers in my first post of this series. And in the second part I’ve covered how to use content […]  Continue Reading  “Android Tutorial: Writing your own Content Provider”

Android Tutorial: Using Content Providers

By

In this tutorial I am going to show you how to make use of existing content providers. It’s the second part of a three part tutorial on content providers. In the first part I covered the common concepts of content providers and in the next part I am going to deal with how to write […]  Continue Reading  “Android Tutorial: Using Content Providers”

Android: Better Performance with ContentProviderOperation

By

ContentProviders are one of Android’s core building blocks. They represent a relational interface to data – either in databases or (cached) data from the cloud. Sometimes you want to use them for multiple operations in a row. Like updating different sources and so on. In those cases you could call the respective ContentResolver methods multiple […]  Continue Reading  “Android: Better Performance with ContentProviderOperation”

How to Correctly Use SQL’s like in Android

By

Yesterday I stumbled about the correct usage of the LIKE-statement in conjunction with selectionArgs. My first attempt was to use it as this: Now this only led to this nice message in the log: Hm. Maybe I should just drop the dashs? But this also didn’t work. The exception though has changed: After searching around […]  Continue Reading  “How to Correctly Use SQL’s like in Android”

Android Tutorial: Content Provider Basics

By

This is the first part of a three part tutorial covering Android’s content providers. Here I’m going to introduce content providers and to cover the basic concepts you need to make use of existing ones or to write content providers on your own. What are content providers? Content providers are Android’s central mechanism that enables […]  Continue Reading  “Android Tutorial: Content Provider Basics”