How to query data in data table?
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.
thanksI 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.
精彩评论