设置SEND_TO_VOICEMAIL Android上的通讯录 [英] Set SEND_TO_VOICEMAIL on Android contacts
问题描述
我试图修改的值 SEND_TO_VOICEMAIL 从0到1,反之亦然。
我成功修改的其他联系人的详细信息,如姓名,号码,昵称,电子邮件,ECC ...但我需要改变SEND_TO_VOICEMAIL。这是两(2)天我得到它疯了!是,即使可能吗?它应该!
I'm trying to modify the value of SEND_TO_VOICEMAIL from 0 to 1 and vice versa. I succeed to modify the others contact's details, such as name, number, nickname, email, ecc... but I need to change SEND_TO_VOICEMAIL. It's 2 (two) days that I'm getting crazy on it!! Is that even possible? It should!
我试过很多可能性,但这应该工作...我猜:
I tried many possibility, but this should work... i guess:
String rawContactId = "1";
ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>();
ops.add(
ContentProviderOperation.newUpdate(ContactsContract.Data.CONTENT_URI)
.withSelection( Data.RAW_CONTACT_ID + "=?" , new String[] { rawContactId })
.withValue(ContactsContract.RawContacts.SEND_TO_VOICEMAIL , 1)
.build()
);
try {
getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops);
} catch (RemoteException e) {
e.printStackTrace();
} catch (OperationApplicationException e) {
e.printStackTrace();
}
但logcat的说:
ERROR / AndroidRuntime(822):android.database.sqlite.SQLiteException:没有这样的列:send_to_voicemail:,在编译:UPDATE数据集send_to_voicemail =? WHERE _id =?
but the logcat says: ERROR/AndroidRuntime(822): android.database.sqlite.SQLiteException: no such column: send_to_voicemail: , while compiling: UPDATE data SET send_to_voicemail=? WHERE _id =?
我真的不知道该怎么去尝试了。任何帮助将是非常美联社preciated。
谢谢你。
I really don't know what to try anymore. Any help would be really appreciated. Thanks.
P.S。
我不是一个真正的Java上一个大师
P.S. I'm not really a guru on java
推荐答案
根据[手册,你正在寻找的SEND_TO_VOICEMAIL场不在ContactsContract.Data表,但在ContactsContract.Contacts表。好像你正在试图修改错误的表。
According to the[manual, the SEND_TO_VOICEMAIL field you're looking for isn't in the ContactsContract.Data table but in the ContactsContract.Contacts table. It seems like you're trying to modify the wrong table.
请参阅 ContactsContract.Data a>并的 ContactsContract.Contacts 中为每个表中的字段。
See ContactsContract.Data and ContactsContract.Contacts for the fields in each table.
这篇关于设置SEND_TO_VOICEMAIL Android上的通讯录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!