How can I create a BehaviorSubject subscribed to an observable?

I have a function which should return a BehaviorSubject. The subject is meant to return the most current version of a Profile (user)Profile is just a POJO that contains references to three members: - a User, - that User's MeasurementList, - and a Dea

RxJava data from the database with list on the screen

I've just begun to learn RxJava and I'm a little bit lost. My scenario is the following: A local NoSQL key-value database where I store some data. The problem is that the endpoint can add data to this DB and also the user can delete some of it. I'm d

Unable to query the domain of use

I am using Realm along with RxJava and at the end i want to fetch an observable that i can use: @Override public Observable<List<Data>> getData_List() { final Observable<RealmResults<Data>> observable = realm.where(Data.class).find

MVP + RxJava - Put Schedulers in the Presenter or Interactor?

I am developing an Android application with MVP and RxJava. Well, I have a doubt: When I am creating my presenter and interactor I can put me Schedulers in the presenter, like this: Schedulers in the Presenter Presenter: override fun tryLogin(usernam

Run doOnNex on ja BehaviorSubject in some thread

so first I will show you what I have and what I think happens there: I have a BehavourSubject<DataObject>: private BehaviorSubject<DataObject> dataSubject = BehaviorSubject.create(); I give it back in a certain function that looks like this: p

RxJava competition with multiple subscribers and events

I'm looking for a way to attach multiple subscribers to an RxJava Observable stream, with each subscriber processing emitted events asynchronously. I first tried using .flatMap() but that didn't seem to work on any subsequent subscribers. All subscri

RxJava - When to use Observable with the create method

I was reading a tutorial: http://code.tutsplus.com/tutorials/getting-started-with-reactivex-on-android--cms-24387 which concers RxAndroid in particular but it's pretty much the same as in RxJava. I am not sure that I understood the concept completely

Kingdom, RxJava, asObservable (), and doOnUnsubscribe ()

In my Android projects, I use realm as my data storage engine. I love it! I also use RxJava because it makes "threading" so much easier, and I really like the whole "reactive mindset". I love it! I use an MVP pattern + some "Clean

Rx-Java centralized management of errors

I use Retrofit as network library with Rx-Java. I want to make some centralized error checking for most requests and handle errors or pass it to subscriber's onError() if I cannot handle it. How could I do this? Something like this projectListObserva

Failed to use phased build project - retrolambda in OSX

I'm a rookie with OSX. Today I try to use RxJava and Retrolambda in Android Studio, Retrolambda needs gradle--retrolambda. So I started config: 1.I pasted a little code to ~/.bash_profile to set the JAVA7_HOME and JAVA8_HOME export JAVA7_HOME=/Librar

Is SerializedSubject needed for thread security in RxJava?

I created a Subject instance in RxJava and call its onNext() from multiple threads: PublishSubject<String> subject = PublishSubject.create(); //... subject.onNext("A"); //thread A subject.onNext("B"); //thread B The RxJava docume

Convert AsyncTask to RxAndroid

I have the following method to post response to UI using otto and AsyncTask. private static void onGetLatestStoryCollectionSuccess(final StoryCollection storyCollection, final Bus bus) { new AsyncTask<Void, Void, Void>() { @Override protected Void d

How to apply an RxJava operator?

I have the following object structure class Object1 { A[] item1; //array of Object A B[] item2; //array of Object B C[] item3; //array of Object C } class C { int value1; int value2; String imageUrl; //null, to be updated from a api call } I get an O

Can RxJava reduce () be dangerous when it is parallelized?

I want to use the reduce() operation on observable to map it to a Guava ImmutableList, since I prefer it so much more to the standard ArrayList. Observable<String> strings = ... Observable<ImmutableList<String>> captured = strings.reduce

Write with a single LMAX thread

I've got introduced to LMAX and this wonderful concept called RingBuffer. So guys tell that when writing to the ringbuffer with only one thread performance is way better than with multiple producers... However i dont really find it possible for tipic

RxJava single background thread scheduler

I'm fairly new to RxJava so this is probably a dumb question. I am going to describe my scenario. I have some code running on the UI thread which will update some images but those images are not very important and they consume a bit of resources whil

rxjava add elements after observable was created

I just started using rxjava and I got stuck. Maybe I'm not using rxjava in the right way, but I need to add items to an Observable after it was created. So I understand that You can just call Observable.just("Some", "Items") and the su

Android: querying a server with Retrofit

I'm building a 2 Player game on Android. The game works turnwise, so player 1 waits until player 2 made his input and vice versa. I have a webserver where I run an API with the Slim Framework. On the clients I use Retrofit. So on the clients I would

Manage Pagination with RxJava

I'm using Retrofit + RxJava on an Android app and am asking myself about how to handle the API pagination to chain calls until all data is being retrieved. Is something like this: Observable<ApiResponse> getResults(@Query("page") int page)

What is the RxJava equivalent of Observable.expand () in RxJs?

In RxJs there is a method called Observable.expand which can recursively expand a sequence with a transformation function. For example, Rx.Observable.return(0).expand(function (x) { return Rx.Observable.return(x+1); }) will emit all integers However,

modernize with rxjava management network exceptions globally

I am trying to handle exceptions in app on global level, so that retrofit throws an error i catch it in some specific class with logic for handling those errors. I have an interface @POST("/token") AuthToken refreshToken(@Field("grant_type&

How can I implement polling using Observables?

I have a parametrized rest call that should be executed every five seconds with different params: Observable<TResult> restCall = api.method1(param1); I need to create an Observable<TResult> which will poll the restCall every 5 seconds with dif