开发者

Problem using ContactsContract.Data when query

开发者 https://www.devze.com 2022-12-20 22:37 出处:网络
I am learning android developing. Well, my appwidget failed at this line: Cursor cursor = context.getContentResolver().query(Contacts.CONTENT_URI,

I am learning android developing. Well, my appwidget failed at this line:

Cursor cursor = context.getContentResolver().query(Contacts.CONTENT_URI,
                new String[] {Contacts.DISPLAY_NAME},
                Contacts.STARRED + "=0", null, null);

May I know why? Thanks.

Added: I have tried a few ways I 开发者_如何学Pythonused in Java to debug this line, all I got was "stop unexpectedly".


Here's a working example that retrieves all data based on name. I notice a couple of differences, so maybe you can compare and figure out your problem:

Cursor cursor = getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, null, "DISPLAY_NAME = '" + NAME + "'", null, null);

0

精彩评论

暂无评论...
验证码 换一张
取 消