Ich habe ein Problem mit meiner RxJava-Callchain. Die toList funktioniert nicht richtig. Ich würde vermuten, dass die toList() etwas zu vervollständigen braucht. Deshalb ist es fest. Aber ich weiß nicht, wie dieses ProblemRxjava tolist() nicht abgeschlossen
Der Code
mModel.getLocations()
.flatMapIterable(new Function<List<Location>, List<Location>>(){
@Override
public List<Location> apply(final List<Location> locations) throws Exception {
return locations;
}
})
.filter(new Predicate<Location>() {
@Override
public boolean test(final Location location) throws Exception {
return location.searchExistInNameOrKeyWord(input);
}
})
.toList()
.map(new Function<List<Location>, List<Location>>() {
@Override
public List<Location> apply(List<Location> locations) throws Exception {
/** Doing some random work with the list and then returning */
}
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Consumer<List<Location>>() {
@Override
public void accept(final List<Location> locations) throws Exception {
mView.setAdapterItems(locations);
}
});
Vielleicht hat jemand zu lösen, die viel besser ist als ich bei RxJava ist, könnte genau feststellen, was ich falsch mache.
aktualisieren
@Query("SELECT * from location")
Flowable<List<Location>> loadAllLocations();
Die mModel.getLocations()
nur die loadAllLocations ruft wie oben vom Zimmer percistance Speicher
Nun, ist "mModel.getLocations()" tatsächlich abgeschlossen? –
hat dem Beitrag einige weitere Informationen hinzugefügt. Das einzige, was es tut, ist, die loadAllLocations aus dem Speicher aufzurufen –