I need to use the getContentResolver method in a class that extends BroadcastReceiver, and I found that getContentResolver can only be used in a class that extends Activity. I am trying to make a static method in a class that extends activity, but I cannot use getContentResolver in a static method. I also tried a non-static method, but when I start the application, I get an error message. How can i do Thank!
In yours onReceive(Context, Intent)you get a Context object that has a method getContentResolver().
onReceive(Context, Intent)
getContentResolver()
ContentResolver contentResolver =context.getContentResolver(); cursor = contentResolver.query(uri, projection, selection, selectionArgs, sortOrder);