首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

android 怎么获取通话记录

2012-07-24 
android 如何获取通话记录String str int typelong callTimeDate dateString time ContentRes

android 如何获取通话记录

  String str = "";  int type;  long callTime;  Date date;  String time= "";  ContentResolver cr = getContentResolver();  final Cursor cursor = cr.query(CallLog.Calls.CONTENT_URI, new String[]{CallLog.Calls.NUMBER,CallLog.Calls.CACHED_NAME,CallLog.Calls.TYPE, CallLog.Calls.DATE}, null, null,CallLog.Calls.DEFAULT_SORT_ORDER);  for (int i = 0; i < cursor.getCount(); i++) {     cursor.moveToPosition(i);  str = cursor.getString(0);  str = cursor.getString(1);  type = cursor.getInt(2);  SimpleDateFormat sfd = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");  date = new Date(Long.parseLong(cursor.getString(3)));  time = sfd.format(date);  }
?

?

热点排行