2

如果我尝试查询CallLog.Calls. 我查询CallLog.CallswithcontentProvider以获取最后一个电话。

谁能帮助我为什么有时会收到此错误?我认为,这是一个系统错误/问题?

Caused by: android.database.sqlite.SQLiteException: no such column: sdn_alpha_id: ,
while compiling: SELECT sns_receiver_count, numberlabel, service_type, matched_number, 
type, contactid, lookup_uri, mime_type, sdn_alpha_id, sp_type, messageid, fname, 
imnum, lname, sns_pkey, account_id, formatted_number, call_out_duration, number,     
geocoded_location, account_name, is_read, raw_contact_id, source_data, cdnip_number,    
state, _subject, date, real_phone_number, source_package, _id, sns_tid, name, 
normalized_number, name_reversed, _data, photo_id, logtype, reject_flag, has_content, 
m_content, country_code, frequent, cityid, bname, countryiso, numbertype, new, 
duration, cnap_name, address, e164_number, voicemail_uri FROM logs WHERE 
(logs.logtype=100 OR logs.logtype=110 OR logs.logtype=500 OR logs.logtype=800 OR 
logs.logtype=900 OR logs.logtype=1000 OR (logs.logtype=200 AND number NOT IN (SELECT 
number FROM logs WHERE number LIKE '%@%')) OR logs.logtype=300) AND ((((type != '4')))) 
ORDER BY date DESC
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:180)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:136)
at android.content.ContentProviderProxy.query(ContentProviderNative.java:358)
at android.content.ContentResolver.query(ContentResolver.java:317)

我查询 CallLog 的代码是:

// get last entry in callLog
Cursor c = context.getContentResolver().query(Calls.CONTENT_URI, null, null, 
null, Calls.DATE + " DESC");
4

1 回答 1

6

更新后我的 GS2 也有同样的问题。我通过在投影中添加我需要的字段而不是 null 来解决它。

例如。

String[] projection = new String[] {CallLog.Calls._ID, CallLog.Calls.CACHED_NAME, CallLog.Calls.DATE, CallLog.Calls.DURATION, CallLog.Calls.NUMBER, CallLog.Calls.TYPE };

Cursor c = context.getContentResolver().query(Calls.CONTENT_URI, projection , null, 
null, Calls.DATE + " DESC");
于 2012-08-09T09:25:26.640 回答