尝试获取合同组时出现问题 ~ 未知 URL 内容://com.android.contacts
尝试获取 Contracts Group 时
Uri contacts = ContactsContract.AUTHORITY_URI;
//Log.v("23",contacts.toString());
// Make the query.
Cursor managedCursor = act.managedQuery(contacts, projection, // Which
// columns
// to
// return
null, // Which rows to return (all rows)
null // Selection arguments (none)
// Put the results in ascending order by name
, ContactsContract.Groups.TITLE + " ASC"
);
出现问题:
<uses-permission android:name="android.permission.READ_CONTACTS"></uses-permission>
<uses-permission android:name="android.permission.WRITE_CONTACTS"></uses-permission>
我明白 错误/DatabaseUtils(198):java.lang.IllegalArgumentException:未知的URL内容://com.android.contacts
Problem when trying to get Contracts Group
Uri contacts = ContactsContract.AUTHORITY_URI;
//Log.v("23",contacts.toString());
// Make the query.
Cursor managedCursor = act.managedQuery(contacts, projection, // Which
// columns
// to
// return
null, // Which rows to return (all rows)
null // Selection arguments (none)
// Put the results in ascending order by name
, ContactsContract.Groups.TITLE + " ASC"
);
Having:
<uses-permission android:name="android.permission.READ_CONTACTS"></uses-permission>
<uses-permission android:name="android.permission.WRITE_CONTACTS"></uses-permission>
I getERROR/DatabaseUtils(198): java.lang.IllegalArgumentException: Unknown URL content://com.android.contacts
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您使用了错误的
Uri
尝试ContactsContract.Groups.CONTENT_URI
从我的角度来看,使用联系人组非常棘手,因此请仔细阅读文档You using wrong
Uri
tryContactsContract.Groups.CONTENT_URI
Work with contacts groups is pretty tricky from my point of view so read documentation carefully是的,URI 错误。下面是一个按名称查找的示例(来自 http://www.androidref.com/#MapLocation ):
杰伊
Yes, wrong URI. Here's an example to find by name (from http://www.androidref.com/#MapLocation):
Jay