将联系人从机器人到SIM卡

问题描述:

我有一个问题,而我试图复制一个接触它存在于Android的联系人应用程序到SIM卡。以下是code:

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);

我有内部的CNAME和cNumber变量的值。但是,当我打印日志看 URI 变量的值:它为null

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.

任何人都可以请让我知道,如果我出了问题的地方在code以上用于插入到SIM卡?

Can anyone please let me know if I have gone wrong somewhere in the code above for inserting to SIM?

我只是实现了一个简单的code中插入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);
}