如何在處理日期和時間時修改領域結果數據?升序和降級對我來說還不夠。RealmResult處理時間限制
說例如我得到的任務是在一小時內到期?
RealmResults<Task> tmp = realm.where(Task.class).findAll();
for (final Task task : tmp) {
String dateFormat = Utility.TIMEFORMAT;
String current = "2:30:00 PM";
Date currentTime = new Date(task.gettime());
//currentTime = new SimpleDateFormat(dateFormat).parse(current);
if(isIncomingWithInHour(currentTime, calendar)){
realmresult.add(tmp) /// this result in error.
}
}
正如你所看到的,ASCENDING和DESCENDING在這種排序中不起作用。無論如何要將reamlResult返回到適配器? Realmresult有一個onchangeListener,我想用它。
這似乎工作。謝謝 – thenewbie