大家好我想根据指定的月份访问某些短信,例如当前月份和上个月。等
我写了这个查询,但是没有用,需要很少的帮助..?
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;
}
答案 0 :(得分:0)
String where = String.format("'%02d'", month) + " = strftime('%m', date)";