Skip to content Skip to sidebar Skip to footer

Using Getcontentresolver In Broadcastreceiver Extended Class

I have to use the getContentResolver method in a class that extends BroadcastReceiver and I found that getContentResolver can be used only in a class that extends Activity. I try t

Solution 1:

In your onReceive(Context, Intent) you receive a Context object which has a getContentResolver() Method.


Solution 2:

ContentResolver contentResolver =context.getContentResolver();
cursor = contentResolver.query(uri, projection, selection, selectionArgs, sortOrder);

Post a Comment for "Using Getcontentresolver In Broadcastreceiver Extended Class"