将联系人从机器人到SIM卡 [英] Insert Contact to SIM from Android

查看:148
本文介绍了将联系人从机器人到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);
}

这篇关于将联系人从机器人到SIM卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆