如何在处理日期和时间时修改领域结果数据?升序和降级对我来说还不够。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