我怎样才能更新呼叫日志条目的内容是什么? [英] How can I update the contents of an entry in the Call Log?
问题描述
我想从未$ C $更新在Android呼叫记录中的第一项的
CallLog.Calls.TYPE
字段C>到接收
。我读的书,开发商参考和GOOGLE上搜索这个死刑,我有理由相信,我的code是正确的。但是,当我真正使呼叫更新()
,其结果是,没有记录被更新。我的code样品如下。
在你问:
- 我对 WRITE_CONTACTS
权限
- 记录被更新(0)确实存在
- 我已经试过这既是一个DroidX(Verizon公司)和三星Galaxy(AT& T公司)
- 我已经试过这code具有相同的结果各种其他形式的长
是否有人可以帮助呢?
ContentValues newValues =新ContentValues();
newValues.put(CallLog.Calls.TYPE,CallLog.Calls.INCOMING_TYPE);
newValues.put(CallLog.Calls.DURATION,50);
INT结果= OsmoService.context.getContentResolver()。更新(
ContentUris.withAppendedId(CallLog.Calls.CONTENT_URI,0),
newValues,NULL,NULL);
如果您更新code以上,更换线路:
ContentUris.withAppendedId(CallLog.Calls.CONTENT_URI,0)
这一行:
Uri.parse(内容:// call_log /呼叫)
它的工作原理。我不知道为什么,但东西是不正确的内容URI。
例如:
ContentValues newValues =新ContentValues();
newValues.put(CallLog.Calls.TYPE,CallLog.Calls.INCOMING_TYPE);
newValues.put(CallLog.Calls.DURATION,50);
INT结果= OsmoService.context.getContentResolver()。更新(
Uri.parse(内容:// call_log /通话),
newValues,
空值,
空值);
I would like to update the CallLog.Calls.TYPE
field of the first entry in the Android Call Log from MISSED
to INCOMING
. I have read books, the developers reference and googled this to death and am reasonably sure that my code is correct. However, when I actually make the call to update()
, the result is that no record is updated. My code sample is below.
Before you ask:
- I have permissions for WRITE_CONTACTS
- The record to be updated (0) does exist
- I have tried this on both a DroidX (Verizon) and a Samsung Galaxy (AT&T)
- I have tried various other, longer forms of this code with same result
Can someone please help with this?
ContentValues newValues = new ContentValues();
newValues.put(CallLog.Calls.TYPE, CallLog.Calls.INCOMING_TYPE);
newValues.put(CallLog.Calls.DURATION, 50);
int result = OsmoService.context.getContentResolver().update(
ContentUris.withAppendedId(CallLog.Calls.CONTENT_URI, 0),
newValues,null,null);
If you update your code above and replace the line:
ContentUris.withAppendedId(CallLog.Calls.CONTENT_URI, 0)
with this line:
Uri.parse("content://call_log/calls")
It works. I don't know why, but something is not correct with the content URI.
example:
ContentValues newValues = new ContentValues();
newValues.put(CallLog.Calls.TYPE, CallLog.Calls.INCOMING_TYPE);
newValues.put(CallLog.Calls.DURATION, 50);
int result = OsmoService.context.getContentResolver().update(
Uri.parse("content://call_log/calls"),
newValues,
null,
null);
这篇关于我怎样才能更新呼叫日志条目的内容是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!