query mapper for single object using Observable<T>
ziahaqi opened this issue · 3 comments
i try to get single user data using Observer getUser(int id) method. but the subscriber dont get back enything, what wrong ?
I've been using a query like this :
return query(SELECT(USER_PROJECTION)
.FROM(User.TABLE_NAME)
.WHERE(User.COL_ID + " = ?"))
.args(String.valueOf(userId))
.run()
.mapToOne(new Func1<Cursor, User>() {
@OverRide
public User call(Cursor cursor) {
//....
}
})
I have tried mapToOne(UserMapper.MAPPER).
and the result still same.
Do you subscribed to that observable? Is Subscriber.onNext()
or Subscriber.onError()
really never called?
yes i did. I already subscribe method on my Presenter by this way :
userObservable.observeOn(AndroidSchedulers.mainThread()).
subscribe(new Subscriber() {
@OverRide
public void onCompleted() {
Log.i(TAG, "onCompleted");
}
@Override
public void onError(Throwable e) {
mLoginView.showError(e.getMessage());
}
@Override
public void onNext(User user) {
mLoginView.onGetUserSuccess(user);
}
});
Can you provide me with some code that I can run and debug?
I really would be surprised if there is a bug in SQLBrite or SQLBrite-DAO