代码如下
AVQuery<AVObject> query = new AVQuery<>("blood_glucose");
//query.selectKeys(Arrays.asList("blood_glucose_value"));
query.whereEqualTo("user", AVUser.getCurrentUser());
query.whereEqualTo("blood_glucose_label",0);
query.orderByDescending("date_time");
query.getFirstInBackground().subscribe(new Observer<AVObject>() {
public void onSubscribe(Disposable disposable) {}
public void onNext(AVObject t) {
if(t!=null) {
valueMap.put("FastBG", t.getString("blood_glucose_value")+" mmol/L");
}else {
valueMap.put("FastBG", "去设置");
}
if(valueMap.size()==size){
_valueList.setValue(valueMap);
}
}
public void onError(Throwable throwable) {
Log.d(TAG,"查询血糖的时候error");
}
public void onComplete() {}
});
数据库中并没有符合条件的数据,按理来说,onNext()的参数会为null,但查询时代码不会进入onNext()函数,这是为什么