Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting "java.lang.illegalArgumentException: invalid column data1"
    primarykey
    data
    text
    <p>I need to add a contact in a contacts group. The group is added but the contact is not added in the group.<br> Here is my code. I think the exception occurs in </p> <pre><code>ContactsContract.CommonDataKinds.GroupMembership.GROUP_ROW_ID </code></pre> <p>but i don't know why.. Can you can help me please?</p> <pre><code>ops.add(ContentProviderOperation .newInsert(ContactsContract.RawContacts.CONTENT_URI) .withValue(ContactsContract.RawContacts.ACCOUNT_TYPE,accountType) .withValue(ContactsContract.RawContacts.ACCOUNT_NAME,accountName) .build()); ops.add(ContentProviderOperation .newAssertQuery(ContactsContract.Groups.CONTENT_URI) .withValueBackReference(ContactsContract.CommonDataKinds.GroupMembership.GROUP_ROW_ID, 0) .withSelection(ContactsContract.Groups.TITLE + "=?", new String[]{grupo}) .withExpectedCount(1) .build()); ops.add(ContentProviderOperation .newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, 0) .withValue(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE) .withValue(ContactsContract.CommonDataKinds.StructuredName.DISPLAY_NAME, nome) .build()); ops.add(ContentProviderOperation .newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, 0) .withValue(ContactsContract.Data.MIMETYPE,ContactsContract. CommonDataKinds.Email.CONTENT_ITEM_TYPE) .withValue(ContactsContract.CommonDataKinds.Email.DATA1, mail) .build()); ops.add(ContentProviderOperation .newInsert(ContactsContract.Data.CONTENT_URI) .withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, 0) .withValue(ContactsContract.CommonDataKinds.GroupMembership.GROUP_ROW_ID, 0) .withValue(ContactsContract.CommonDataKinds.GroupMembership.MIMETYPE, ContactsContract.CommonDataKinds.GroupMembership.CONTENT_ITEM_TYPE) .build()); try { resolver.applyBatch(ContactsContract.AUTHORITY, ops); } catch(Exception e) { e.printStackTrace(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload