0
當我做下面的代碼沒有這種比較它的作品,但與比較失敗。android.provider.CallLog.Date比較失敗
感謝Oleg Vaskevich,用他的觀點更新了代碼。 和日期範圍是1-31不像日期(長)更換月0-11 和日期(INT,INT,INT)
編輯的代碼
Calendar cal = Calendar.getInstance();
cal.add(Calendar.MONTH, -1);
int month = cal.get(Calendar.MONTH);
int year = cal.get(Calendar.YEAR);
int day=cal.get(Calendar.DATE); // for dynamic reset rates
callSince.setText("since(dd/mm/yyyy) :" + day + "/" + (month+1) + "/" + year);
// month+1 because month {0-11}
Date resetDateDate = new Date(cal.getTimeInMillis());
Calendar resetDateCal = Calendar.getInstance();
resetDateCal.setTime(resetDateDate);
String resetDate = String.valueOf(resetDateCal.getTimeInMillis());
/*
* CALL INCOMING
*/
projection = new String[] {CallLog.Calls.DURATION };
selection = CallLog.Calls.TYPE + "=? AND " + CallLog.Calls.DATE + " >=?" ;
selectionArgs = new String[] { (String.valueOf(CallLog.Calls.INCOMING_TYPE)) , (resetDate) };
try
{
Cursor cIn = getContentResolver().query(CallLog.Calls.CONTENT_URI, projection, selection, selectionArgs, sortOrder);
startManagingCursor(cIn);
我的意思是沒有這種比較,我可以檢索一些數據,而比較我沒有得到。注意:沒有例外提升 –