I have an issue while I try to copy a contact which exists in the android contacts application to the SIM card. Following is the code:
ContentValues cv = new ContentValues();
cv.put("tag", cName);
cv.put("number", cNumber);
Uri uri = context.getContentResolver().insert(SIM_CONTENT_URI, cv);
Log.d(TAG_LOG, "URI is : " + uri);
I have values inside cName and cNumber variables. But when I print the log to see the value of the uri
variable: it is null.
Can anyone please let me know if I have gone wrong somewhere in the code above for inserting to SIM?
I just have implemented a simple code to insert contact in SIM card, maybe it can help you:
private void insertSIMContact(String number, String name) {
Uri simUri = Uri.parse("content://icc/adn");
ContentValues values = new ContentValues();
values.put("number", number);
values.put("tag", name);
getContentResolver().insert(simUri, values);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With