答案 0 :(得分:3)
我自己找到了答案
public Loader<Cursor> onCreateLoader(int loaderID, Bundle args) {
Log.d("CallLogs", "onCreateLoader() >> loaderID : " + loaderID);
switch (loaderID) {
case URL_LOADER:
String mSelectionClause = android.provider.CallLog.Calls.DATE+ " >= ?";
String[]mSelectionArgs = {createDate()};
// Returns a new CursorLoader
return new CursorLoader(
mContext, // Parent activity context
CallLog.Calls.CONTENT_URI, // Table to query
null, // Projection to return
mSelectionClause, // No selection clause
mSelectionArgs, // No selection arguments
CallLog.Calls.DATE + " desc" // Default sort order
);
default:
return null;
}
}
public String createDate()
{
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DATE, -1);
return String.valueOf(calendar.getTimeInMillis());
}