,我有一個廣播接收器中運行此代碼:嘗試基於以前的答案,我得查詢ContactList
Uri lookupUri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(ASenderTel));
// Also tried;
//ContentResolver cr = getContentResolver();
//Context c = this;
Cursor c = getContentResolver().query(lookupUri, new String[] { PhoneLookup._ID }, null, null, null);
return (c.getCount() > 0);
...但得到錯誤信息「時,方法getContentResolver()是未定義的類型KITSMSReceiver「
如果我使用: ContentResolver的CR = getContentResolver()查詢(lookupUri, 新的String [] {} PhoneLookup._ID ,null,null,null); ...的錯誤消息,則「的方法getContentResolver()是未定義的類型KITSMSReceiver」 (KITSMSReceiver是一個BroadcastReceiver) – 2011-12-27 01:05:15