Couldn't read row 0, col -1 from CursorWindow. Make sure the Cursor is initialized correctly before
andriod开发查询通话记录的时候报错,源码如下
//获取通话记录 private void getContentCallLog() { try{ Cursor cursor = getContentResolver().query(callUri, // 查询通话记录的URI columns , null, null, CallLog.Calls.DEFAULT_SORT_ORDER// 按照时间逆序排列,最近打的最先显示 ); String str=""; // Log.i(TAG,"cursor count:" + cursor.getCount()); while (cursor.moveToNext()) { //String vname = cursor.getString(cursor.getColumnIndex("sub_id")); //姓名 String name = cursor.getString(cursor.getColumnIndex(CallLog.Calls.CACHED_NAME)); //姓名 String phoneid = cursor.getString(cursor.getColumnIndex(CallLog.Calls.PHONE_ACCOUNT_ID)); //姓名 String number = cursor.getString(cursor.getColumnIndex(CallLog.Calls.NUMBER)); //号码 String phoneconpid = cursor.getString(cursor.getColumnIndex(CallLog.Calls.PHONE_ACCOUNT_COMPONENT_NAME)); //号码 long dateLong = cursor.getLong(cursor.getColumnIndex(CallLog.Calls.DATE)); //获取通话日期 String date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(dateLong)); String time = new SimpleDateFormat("HH:mm").format(new Date(dateLong)); int duration = cursor.getInt(cursor.getColumnIndex(CallLog.Calls.DURATION));//获取通话时长,值为多少秒 int type = cursor.getInt(cursor.getColumnIndex(CallLog.Calls.TYPE)); //获取通话类型:1.呼入2.呼出3.未接 String dayCurrent = new SimpleDateFormat("dd").format(new Date()); String dayRecord = new SimpleDateFormat("dd").format(new Date(dateLong)); str=str.concat(number+"#"+vname+"#"+phoneid+"#"+phoneconpid+"\n"); // Log.i(TAG,"Call log: " + "\n" // + "name: " + name +"\n" // + "phone number: " + number + "\n" // // ); TextView bfws = findViewById(R.id.bfw); bfws.setText(str); } }catch (Exception e){ TextView bfws = findViewById(R.id.bfw); bfws.setText(e.getMessage()); } // TextView bfws = findViewById(R.id.bfw); // bfws.setText(str); }
webrtc进行p2p连接发送的文本音视频文件是否是加密的?
如何让一个可爱的三维动物通过three在浏览器中有表情动作的自然说话?
go与wails如何开发一个高性能的原生桌面应用?
python如何调用openai的api实现知识讲解类动画讲解视频的合成?
html如何直接调用openai的api实现海报可视化设计及文本描述生成可编辑海报?
f12前端调试如何找出按钮点击事件触发的那段代码进行调试?
abcjs如何将曲谱播放后导出mid和wav格式音频下载?
python如何将曲子文本生成音乐mp3或wav、mid文件
python中mp3、wav音乐如何转成mid格式?
js在HTML中如何将曲谱生成音乐在线播放并下载本地?