0

大家好,我想根据指定的月份访问某些短信,例如当前月份和上个月。等等

我写了这个查询,它不起作用,需要一点帮助..?

Cursor c1;
    String[] projection={"_id","address", "date"};

    Calendar calendar = Calendar.getInstance();
    int month = calendar.get(Calendar.MONTH) + 1;
    String where= month +"=date(date,%m)";
    c1 = getApplicationContext().getContentResolver().query(Uri.parse("content://sms/inbox"), projection,where, null,null);

也有人可以告诉我为什么我在下面的注释代码行中遇到错误

c2 = getContentResolver().query(android.provider.CallLog.Calls.CONTENT_URI,
                null, android.provider.CallLog.Calls.TYPE+"="+android.provider.CallLog.Calls.INCOMING_TYPE, null,null);


        if(c2!=null){
            callArray[2]= "RECEIVED "+c2.getCount();    
            callArray[3]= "INCOMING Duration : "+00.00;
            //c2.getString(c2.getColumnIndex(android.provider.CallLog.Calls.DURATION));
        }else{
            callArray[2]= "RECEIVED "+0;
            callArray[3]= "INCOMING Duration :"+0;
        }
4

1 回答 1

0
String where = String.format("'%02d'", month) + " = strftime('%m', date)";
于 2013-03-18T22:03:59.170 回答