getCallDetailsAgil()函数中的if语句不起作用。该语句在切换情况下,在其中检查呼叫类型是否为MISSED 有人可以帮我吗? startdate和enddate是公开日期对象。我只是想遮住两个日期之间所有未接的电话。
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_incoming);
Intent i = getIntent();
//
}
private int getCallDetailsAgil() {
StringBuffer sb = new StringBuffer();
Cursor managedCursor = managedQuery(CallLog.Calls.CONTENT_URI, null, null, null, null);
int type = managedCursor.getColumnIndex(CallLog.Calls.TYPE);
int date = managedCursor.getColumnIndex(CallLog.Calls.DATE);
int count=0;
while (managedCursor.moveToNext()) {
String callType = managedCursor.getString(type);
String callDate = managedCursor.getString(date);
Date dc = new Date(Long.valueOf(callDate));
String dir = null;
int dircode = Integer.parseInt(callType);
switch (dircode) {
case CallLog.Calls.INCOMING_TYPE:
System.out.println("---------" + startdate.toString());
System.out.println(dc.toString());
System.out.println("---------" + enddate.toString());
System.out.println(dc.before(startdate)+" "+dc.before(enddate));
if (dc.before(startdate) && dc.before(enddate))
count++;
break;
}
}
return count;
}