开发者

Problem using ContactsContract.Data when query

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜