有谁知道如何显示个人通话的通话记录详细信息?当我进入通话记录时,显示的唯一时间是“1 小时前、3 小时前、昨天、2 天前”等。有没有办法查看通话的实际时间和日期?另外,我注意到在查看此信息的短信时,“发送”时间是不准确的。有人可以在上午 12:51 给我发短信,电话会显示“下午 6:31 发送,上午 12:51 收到”。有谁知道如何解决这一问题?
Cursor callLogCursor = getContentResolver().query(
android.provider.CallLog.Calls.CONTENT_URI, null, null, null,
android.provider.CallLog.Calls.DEFAULT_SORT_ORDER);
if (callLogCursor != null) {
while (callLogCursor.moveToNext()) {
String name = callLogCursor.getString(callLogCursor
.getColumnIndex(CallLog.Calls.CACHED_NAME));
String number = callLogCursor.getString(callLogCursor
.getColumnIndex(CallLog.Calls.NUMBER));
long dateTimeMillis = callLogCursor.getLong(callLogCursor
.getColumnIndex(CallLog.Calls.DATE));
String duration = callLogCursor.getString(callLogCursor
.getColumnIndex(CallLog.Calls.DURATION));
int callType = callLogCursor.getInt(callLogCursor
.getColumnIndex(CallLog.Calls.TYPE));
Date date = new Date(dateTimeMillis);
String dateString = new SimpleDateFormat("yyyy-MM-dd HH:mm")
.format(date);
if (name == null)
name = "Unknown";
int type = 0;
switch (callType) {
case CallLog.Calls.OUTGOING_TYPE:
type = R.drawable.out;
break;
case CallLog.Calls.INCOMING_TYPE:
type = R.drawable.in;
break;
case CallLog.Calls.MISSED_TYPE:
type = R.drawable.miss;
break;
}
Thanks for your help!