gpt4 book ai didi

android - 检索未从 Android 联系人列表中删除的电话号码

转载 作者:行者123 更新时间:2023-11-29 01:28:46 24 4
gpt4 key购买 nike

我正在尝试从 ContactsContract 中检索未标记为要删除的电话号码。

@Override
public Loader onCreateLoader(int id, Bundle args) {
return new CursorLoader(
this,
ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
new String[]{
ContactsContract.CommonDataKinds.Phone.NUMBER
},
ContactsContract.CommonDataKinds.Phone.DELETED + "==0",
null,
null);
}

但是,我遇到以下错误:

java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:304)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
Caused by: android.database.sqlite.SQLiteException: no such column: deleted (code 1): , while compiling: SELECT DISTINCT data1 FROM view_data data LEFT OUTER JOIN (SELECT data_usage_stat.data_id as STAT_DATA_ID, SUM(data_usage_stat.times_used) as times_used, MAX(data_usage_stat.last_time_used) as last_time_used FROM data_usage_stat GROUP BY data_usage_stat.data_id) as data_usage_stat ON (STAT_DATA_ID=data._id) WHERE (1 AND mimetype_id=5) AND ((deleted==0))
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:181)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:137)
at android.content.ContentProviderProxy.query(ContentProviderNative.java:421)
at android.content.ContentResolver.query(ContentResolver.java:478)
at android.content.CursorLoader.loadInBackground(CursorLoader.java:64)
at android.content.CursorLoader.loadInBackground(CursorLoader.java:42)
at android.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:312)
at android.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:69)
at android.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:57)
at android.os.AsyncTask$2.call(AsyncTask.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)

The documentation for ContactsContract.CommonDataKinds.Phone.CONTENT_URI指出数据记录将与关联的原始联系人和聚合联系人数据相结合。但是“删除”不存在。为什么以及如何才能只获取未删除的电话号码?

最佳答案

数据 URI 投影没有 DELETED 列,在任何情况下,您的查询都应该只检索未删除的联系人的电话号码。你能得到已删除的原始联系人的电话号码吗?

关于android - 检索未从 Android 联系人列表中删除的电话号码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32425825/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com