通话记录展示

This commit is contained in:
GYJ
2024-11-23 16:53:30 +08:00
parent a82e726d5f
commit 0f3e728a79
11 changed files with 343 additions and 14 deletions

View File

@@ -40,7 +40,7 @@ public class CallManager {
@SuppressLint("Range") String number = cursor.getString(cursor.getColumnIndex(CallLog.Calls.NUMBER)); //号码
@SuppressLint("Range") long dateLong = cursor.getLong(cursor.getColumnIndex(CallLog.Calls.DATE)); //获取通话日期
@SuppressLint("SimpleDateFormat") String date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(dateLong));
// @SuppressLint("SimpleDateFormat") String time = new SimpleDateFormat("HH:mm").format(new Date(dateLong));
@SuppressLint("SimpleDateFormat") String time = new SimpleDateFormat("HH:mm").format(new Date(dateLong));
@SuppressLint("Range") int duration = cursor.getInt(cursor.getColumnIndex(CallLog.Calls.DURATION));//获取通话时长,值为多少秒
@SuppressLint("Range") int type = cursor.getInt(cursor.getColumnIndex(CallLog.Calls.TYPE)); //获取通话类型1.呼入2.呼出3.未接
// @SuppressLint("SimpleDateFormat") String dayCurrent = new SimpleDateFormat("dd").format(new Date());
@@ -53,6 +53,7 @@ public class CallManager {
callLog.put("date", date);
callLog.put("duration", duration);
callLog.put("type", type);
callLog.put("time", time);
} catch (Exception e) {
e.printStackTrace();
}