android, getContentResolver() outside Activity

getContentResolver() is a method of Context, so my guess is that your class is not derived fromActivity (which is derived from Context).

You have to use a context variable if you want to call it outside of an activity class (context.getContentResolver()). If your class is a BroadcastReceiver then the context variable is given as an argument in onReceive(). If not, you have to send it to your method when you call it.

posted @ 2013-03-01 08:30  花开花落云卷云舒  阅读(210)  评论(0)    收藏  举报