开发者

How to query data in data table?

开发者 https://www.devze.com 2023-04-09 00:48 出处:网络
I used the following code to insert two row in data table: ops.add(ContentProviderOperation.newInsert(RawContacts.CONTENT_URI).withValue(

I used the following code to insert two row in data table:

ops.add(ContentProviderOperation.newInsert(RawContacts.CONTENT_URI).withValue(
                RawContacts.ACCOUNT_TYPE, null).withValue(RawContacts.ACCOUNT_NAME,
                null).build());

        ops.add(ContentProviderOperation.newInsert(Data.CONTENT_URI).withValueBackReference(
                Data.RAW_CONTACT_ID, rawContactInsertIndex).withValue(Data.MIMETYPE,
                StructuredName.CONTENT_ITEM_TYPE).withValue(StructuredName.DISPLAY_NAME,
                "a").build());
     开发者_Go百科   ops.add(ContentProviderOperation.newInsert(Data.CONTENT_URI).withValueBackReference(
                Data.RAW_CONTACT_ID, rawContactInsertIndex).withValue(Data.MIMETYPE,
                        GroupMembership.CONTENT_ITEM_TYPE).withValue(CommonDataKinds.GroupMembership.GROUP_ROW_ID,
                        "groupa").build());

So i got two new line in data table.But when i want to get a contact's groupId which display_name is a, i don`t know how to do.

thanks


I feel more than content providers SQLite3 is a better option to work with.


I have found the answer myself. RawContactsEntity can solve the problem properly.

0

精彩评论

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