title: how to add a contact to a group android
body: <p>I have following code to add contact to a group into android's contact app / people app, it does add the group but not the contact in that group, what am i missing ? I am adding contact successfully also creating group, i do get the ids of both the things , i m using following code to associate the contact with the group but its not working , group is always empty.</p>
  
  <pre><code> public Uri addToGroup(long personId, long groupId) {
  
      ContentValues values = new ContentValues();
      values.put(ContactsContract.CommonDataKinds.GroupMembership.RAW_CONTACT_ID,
              personId);
      values.put(
              ContactsContract.CommonDataKinds.GroupMembership.GROUP_ROW_ID,
              groupId);
      values
              .put(
                      ContactsContract.CommonDataKinds.GroupMembership.MIMETYPE,
                      ContactsContract.CommonDataKinds.GroupMembership.CONTENT_ITEM_TYPE);
  
      return this.getActivity().getContentResolver().insert(
              ContactsContract.Data.CONTENT_URI, values);
  
  }
  </code></pre>
  
  <p>****update *****
  Another thing i found is this group which i created doesn't get sync with google , probably thats the reason contacts aren't getting added.</p>