Guest User

Untitled

a guest
May 27th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. batch = new ArrayList<ContentProviderOperation>();
  2. +int currentContactIndex = 0;
  3.  
  4. for ( User contact : new User[] { alice, bob, carol } ) {
  5.  
  6. builder = ContentProviderOperation.newInsert(RawContacts.CONTENT_URI);
  7. batch.add(builder.build());
  8.  
  9. builder = ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI);
  10. - builder.withValueBackReference(Email.RAW_CONTACT_ID, 0);
  11. + builder.withValueBackReference(Email.RAW_CONTACT_ID, currentContactIndex);
  12. batch.add(builder.build());
  13.  
  14. builder = ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI);
  15. - builder.withValueBackReference(Phone.RAW_CONTACT_ID, 0);
  16. + builder.withValueBackReference(Phone.RAW_CONTACT_ID, currentContactIndex);
  17. batch.add(builder.build());
  18.  
  19. + currentContactIndex += 3;
  20. }
Add Comment
Please, Sign In to add comment