如何在呼叫类型(呼入/呼出/未接)存储在Android的通话记录? [英] How are call types (Incoming/Outgoing/Missed) stored in Android Call Log?
问题描述
这可能是一个愚蠢的问题,我是一个有点小白的。我正在读这篇文章:如何访问通话记录Android版
This may be a silly question, I'm a bit of a noob. I was reading this post: How do i access call log for android?
和在的code底部的答案,他们有这样一行:
and in the answer at the bottom of the code they have this line:
int type = Integer.parseInt(c.getString(c.getColumnIndex(CallLog.Calls.TYPE)));// for call type, Incoming or out going
我有点困惑,如何呼叫类型存储,是它作为一个字符串或整数? 的code所示行让我觉得它保存为一个数字,但在字符串格式。谁能解释这样对我?
I'm a little confused as to how the call type is stored, is it as a string or as an integer? The line of code shown makes me think its saved as a number, but in string format. Can anyone explain this to me?
谢谢, 马特
推荐答案
该类型存储为整数。这是我如何获得新的未接来电列表:
The type is stored as integer. This is how I get a list of new missed calls:
cursor = cr.query(Uri.parse("content://call_log/calls"), null, "type = 3 AND new = 1", null, "date DESC");
当然使用CallLog.Calls.MISSED_TYPE中,INCOMING_TYPE和OUTGOING_TYPE恒效果会更好。
Of course using the CallLog.Calls.MISSED_TYPE, INCOMING_TYPE and OUTGOING_TYPE constant would be better.
这篇关于如何在呼叫类型(呼入/呼出/未接)存储在Android的通话记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!