Closed scsfwgy closed 6 years ago
This question is not RxAndroid related. Switching threads unnecessarily is always a performance loss and RxJava does its best to avoid that. It really depends on what flow you have assembled in what context.
in this context:
//pseudo-code
websocket(Callback(data){
//websocket very frequent data in no main thread
Observable.just(data)
.observeOn(Schedulers.computation())
.subscribe(data -> {
//computation thread
map2Obj(data);
});
});
//computation
void map2Obj(data){
//....
then change to main thread
}
thx!
Please ask questions on StackOverflow or the RxJava mailing list.
like this: