I am trying to add a contact to the phone address book.
I have been successful: I added a new contact and assigned a mobile number to it.
Now I need add a JPG I have in my resources directory to the contact as the contact photo.
I am looking for a tutorial, but can't find any.
I need to target old phones, so I need to use the old Contacts API.
Can anyone help?
ContentValues contact = new ContentValues();
contact.put(People.NAME, "testContact");
Uri insertUri = activity.getContentResolver().insert(People.CONTENT_URI, contact);
Uri phoneUri = Uri.withAppendedPath(insertUri, People.Phones.CONTENT_DIRECTORY);
contact.clear();
contact.put(People.Phones.TYPE, People.TYPE_MOBILE);
contact.put(People.NUMBER, "12128911");
updateUri = activity.getContentResolver().insert(phoneUri, contact);