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); }
听说Gemini 1.5 Flash能根据你的录屏操作网页视频生成Selenium代码?
coze Webhook URL发送触发器报错:{"code":41001004,"data":{"items":[]},"items":[],"message":"RecordNotFound:Pl
sms-activate中的虚拟手机号为啥无法用作google的手机号码验证?
app如何判断自己的网络连接是经过代理传输的?
有没有开源的andriod安卓设备集中管理工具?
acejs如何监听回车并获取上一行文本是否是注释?
SSL证书中OV和DV有啥区别,该如何选择?
python如何批量压缩目录及子目录图片到指定大小内?
google账号如何更改地区与国家?
为啥我的安卓手机chatgpt app打开报错Something went wrong. You may be connected to a disallowed ISP. If you are us