> allUserDatas(); @Insert(onConflict =...">

Why definition of Flowable I could receive DB updates

@Query("SELECT * FROM userdata") Flowable<List<UserData>> allUserDatas(); @Insert(onConflict = OnConflictStrategy.REPLACE) List<Long> insert(List<UserData> datas); userDao.allUserDatas() take(1). filter(....) .subscribeOn(io()) .observeOn(mainThread()) .subscribe(userDatas -> Log.i("TAG",""+userDatas)); 

I added a subscription select in the same fragment to onAttach (), but after updating the database it does not call a subscription to the selection from the database, why

+7
android rx-java persistence
source share
2 answers

I found a problem.

This was due to take(1) , as it becomes complete, and therefore I could not listen to the changes. take(1) removal fixed.

+6
source share

It seems that you should add Flowable allUserDatas () to the CompositeDisposable instance, and then your subscription will be alive until you call Clear CompositeDisposable.

+3
source share

All Articles