These are chat archives for ReactiveX/RxJava

Aug 2018
Ignacio Baca Moreno-Torres
Aug 26 2018 07:08
You can use a combine latest for example, but the the buffer will grow until the request completes, alternatively you can make the request and we it completes flatMap it with the stream, so you don't need the buffer
James Fleming
Aug 26 2018 08:12
What would be the best way to start the async task once the stream has started? I'm cautious of interrupting the flow of the stream
Igor Bozin
Aug 26 2018 09:30

@akarnokd already tried it.

                .concatMap(new Function<ArrayList<Uri>, Observable<RxObservableList<Uri>>>() {
                    public Observable<RxObservableList<Uri>> apply(ArrayList<Uri> uriArrayList) throws Exception {
                        mAdapter = new PictureRvAdapter(MarkerActivity.this, uriArrayList, MarkerActivity.this);
                        LinearLayoutManager layoutManager = new LinearLayoutManager(MarkerActivity.this, LinearLayoutManager.VERTICAL, false);
                        DividerItemDecoration decoration = new DividerItemDecoration(getApplicationContext(), VERTICAL);
                        beginTransition(constraintSetEnd, 850);
                        Log.d(TAG, "Adapter set, transition started");

                        return uriObservableList.getObservable();
                        //return Observable.just(uriObservableList);
                .doOnNext(new Consumer<RxObservableList<Uri>>() {
                    public void accept(RxObservableList<Uri> uris) throws Exception {
                        String pathString = makePathString(uris.getList());
                        Log.d(TAG, "Updated pictures in database");
                .subscribe(new Observer<RxObservableList<Uri>>() {
                    public void onSubscribe(Disposable d) {
                        Log.d(TAG, "Onsubscribe called");

                    public void onNext(RxObservableList<Uri> uris) {
                        Log.d(TAG, "Adapter pictures updated");

                    public void onError(Throwable e) {
                        Log.d(TAG, "OnError : " + e);

                    public void onComplete() {
                        Log.d(TAG, "OnComplete called");

still gives me this error: MarkerActivity: OnError : java.lang.IllegalStateException: Cannot access database on the main thread since it may potentially lock the UI for a long period of time.

Ignacio Baca Moreno-Torres
Aug 26 2018 09:48
Observable<String> stream = Observable.fromArray("a", "b", "c");
Observable<String> request = Single.just("1").toObservable();
stream.withLatestFrom(request, (streamItem, requestItem) -> streamItem + requestItem)
// output: a1b1c1
Nicholas Bransby-Williams
Aug 26 2018 14:41
What combination of operators do I need to achieve the following
Nicholas Bransby-Williams
Aug 26 2018 14:52
Combine two streams into one which only emits an item( or completes ) as soon as both streams have emitted the same number of items (at least 1)
Been studying the operators but can’t see an obvious way to do it