I am working on android apps. I want to add a contact in android phone group. The code I am using is below:
ContentValues values = new ContentValues();
Intent intent = new Intent(Intent.ACTION_INSERT);
intent.setType(ContactsContract.Contacts.CONTENT_TYPE);
intent.putExtra(ContactsContract.Intents.Insert.NAME, fullname);
intent.putExtra(ContactsContract.Intents.Insert.PHONE,phoneno);
intent.putExtra(ContactsContract.Intents.Insert.EMAIL, email);
intent.putExtra(ContactsContract.Intents.Insert.NOTES,
"Imported from moodle");
intent.putExtra(ContactsContract.Intents.Insert.POSTAL, city
+ " " + country);
startActivityForResult(intent, 1);
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK) {
switch (requestCode) {
case 1:
if (requestCode == 1) {
}
super.onActivityResult(requestCode, resultCode, data);
}
}
}