这可能是一个愚蠢的问题,我是一个有点小白的。我正在读这篇文章:如何访问通话记录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.