I would like to intent to the android contact window to update or modify a user contact details. The code below works fine, however, it does not pass the correct phone number to the android contact editor window.
This is my code
private void modifyContact() {
phonenumber="0711236763";
mSelectedContactUri=Uri.parse(phonenumber);
mCursor = getContentResolver().query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
if (mCursor != null && mCursor.moveToFirst()) {
mLookupKeyIndex = mCursor.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY);
mCurrentLookupKey = mCursor.getString(mLookupKeyIndex);
mIdIndex = mCursor.getColumnIndex(ContactsContract.Contacts._ID);
mCurrentId = mCursor.getLong(mIdIndex);
}
mSelectedContactUri = ContactsContract.Contacts.getLookupUri(mCurrentId, mCurrentLookupKey);
Intent editIntent = new Intent(Intent.ACTION_EDIT);
editIntent.setDataAndType(mSelectedContactUri, ContactsContract.Contacts.CONTENT_ITEM_TYPE);
editIntent.putExtra("finishActivityOnSaveCompleted", true);
startActivity(editIntent);
}
The variable phonenumber
is the phone number for which i would like to modify or update.