4,138
questions
0
votes
2
answers
56
views
Fire and forget coroutine job
Here is a the actual code in Rxjava. Its a fire and forget database operation
fun saveResponseToDb() {
Observable.just(database)
.subscribeOn(Schedulers.io())
.observeOn(...
0
votes
0
answers
16
views
Unresolved reference AndroidSchedulers
I'm using version 2.1.1 of RxAndroid and 2.0.1 of RxJava, but I have no access to AndroidSchedulers.
I made sure my dependencies are properly declared in the app gradle build, and I tried the ...
-1
votes
1
answer
45
views
RxJava strip bytes at regular interval from a stream and then further extract messages based on length indicator of message bytes
I have a Java inputstream, that I skip 2 bytes every n bytes. Now the output of that are bytes that are clean after stripping the 2 delimiters every n bytes.
This output is a series of bytes where the ...
0
votes
0
answers
9
views
Any case that the return type of a Web API has to be an Observable and can NOT be a Single?
I'm learning RxJava and Retrofit2 and wondering if there is any case that the return type of a Web API has to be an Observable and can not be a Single.
As far as I can think of ... even paged datas ...
0
votes
1
answer
53
views
How to trigger recomposition when observing LiveData
I'm migrating an app from views to compose and am trying to trigger a schedule update every five minutes in which if there is a change in the data compose should recompose. Still using RxJava in my ...
0
votes
1
answer
29
views
Getting Compilation Failure "cannot find symbol for concatMap" in the RxJava Code
I am new to this RxJava coding language.
I am trying to write a function that recursively copies files from one S3 location and pastes the content to another S3 location.
Here is the code that I have ...
0
votes
1
answer
512
views
IllegalStateException: Reading a state that was created after the snapshot was taken or in a snapshot that has not yet
Assume simplfied class like:
class MyModel() {
companion object
val number = mutableStateOf(0)
init {
refresh()
}
fun refresh() {
RestClient.getNumber()
...
0
votes
0
answers
36
views
RxJava Scheduler scheduleDirect guarantees
If I have some code like the following:
Schedulers.single().scheduleDirect {
Schedulers.single().scheduleDirect {
println("Run inner code") // Line A
}
println("...
2
votes
0
answers
31
views
Where do I put the Disposable for RxJava?
I'm using RxJava2 and subscribing to my data streams with a CompositeDisposable variable. I'm familiar with codebases having the disposable in the Fragment/Activity, but I'm not entirely sure why that ...
1
vote
1
answer
47
views
RxJava PublishSubject buffer elements with timeout
I want to achieve the following with RxJava:
Buffer elements and publish them when 5 seconds passed after the last element
Publish buffered elements in 20 seconds passed after the first element
...
0
votes
1
answer
24
views
adjust delay value in rx java from source
I'm new to Rxjava and could not find an example or appropriate usage of single.delay() that uses the result of the previous flatmap as the delay. My aim is to use the result of functionOne() to set ...
0
votes
0
answers
35
views
Does the Observable.take(1) function dispose itself after taking 1?
Does an Observable.take(1) function dispose itself after taking 1?
0
votes
1
answer
36
views
retryWhen hanging after migrating from rxjava to rxjava2
We have the following methods which we have recently migrated from rx-java to rx-java2:
@Override
public Observable<FooResponse> doFoo(String id) {
return api.doFoo(id)
.map(Response::...
0
votes
1
answer
30
views
How to update the first observable with the data of the second dependent on the first
In Android using Retrofit combined with RxJava I get an object Observable. Inside I have a List; inside Table I have properties containing a foreign key from the object Product.
My goal is to get the ...
0
votes
0
answers
63
views
Reduce response time
The operation api.getProducts(..) with the help of Retrofit, we invoke a GET from another API. Now, repeatUntil() is used since the other API returns a page and there is a specific documentId that has ...
0
votes
0
answers
65
views
RxJava2 onNext can't execute after FlowableEmitter.onNext executed many times
I called the Flowable.create to implement that loop read data from bluetooth sockete InputStream, I try the below pseudocode to implement this.
// connectBluetoothFlowable is a Flowable<Boolean>
...
0
votes
0
answers
40
views
Android: NPE: Observable.takeLast
I set up some observables like so
companion object {
var isLocationToolActive: BehaviorSubject<Boolean> = BehaviorSubject.createDefault(false)
var isAoIToolActive: ...
1
vote
2
answers
65
views
Combine 2 data sources in RxJava with possibility to fetch new data from 1 of the observables
I'm currently working on an Android app where I'm using RxJava in a ViewModel to handle data from both a local Room database and a remote API (Retrofit). I have implemented a pull-to-refresh feature, ...
0
votes
1
answer
40
views
Observable.fromCallable() method inside not getting called
This is how i'm using the Observable.fromCallable(). In other classes its working fine, but not in some of the classes. Any help would be appreciated.
Observable
.fromCallable(() ->
...
-1
votes
1
answer
57
views
Expected begin_array but was begin_object at line 1 column 2 path $ on Kotlin+Android
I called the PetFinder API to get data. When I wanted to show the data on screen I got this error. I used Call sequence to get data and I used enqueue on the ViewModel.
I tried to use fromJson() ...
2
votes
1
answer
264
views
Kotlin coroutines onErrorReturn (RX Java counterpart)
In RX Java there is a possibility to provide a default value in case of error, with a variety of onError... methods.
What is the counterpart in Kotlin coroutines?
I understand I can wrap code inside ...
1
vote
1
answer
355
views
How to zip for Maybe when one of it is empty
I'm trying to zip multiple sources of Maybe, but there is a possibility that one of it could be empty.
Maybe<ObjectA> aMaybe = Maybe.just("1");
Maybe<ObjectB> bMaybe = Maybe....
0
votes
1
answer
42
views
How to create a sequential RxJava chain from Completable to Single?
I have a scenario where I need to create a sequential chain using RxJava in Kotlin. Specifically, I want to create a chain that starts with a Completable and then proceeds to a Single operation.
Here ...
0
votes
0
answers
46
views
RxJava - Adding new duplicate observer each call
I have a function that gets called from the response of a Flowable. It's an API request that returns a Single.
private fun syncUser() {
getUserUseCase.getUser() //Flowable DB (Room) call
...
0
votes
0
answers
178
views
Rx2AndroidNetworking that created by amitshekhar not work with android version 31 and above
I get this error message when making a request by Rx2AndroidNetworking.
java.lang.IllegalArgumentException: com.gomini.gominipassenger: Targeting S+ (version 31 and above) requires that one of ...
0
votes
1
answer
376
views
Can't create handler inside thread Thread[RxCachedThreadScheduler-1,5,main] that has not called Looper.prepare()
I'm rewriting an Android app using retrofit + RxJava. I'm new about Retrofit and RxJava, so I have some problem and I can't solve the error:"
Can't create handler inside thread Thread[...
0
votes
0
answers
17
views
Observable.toFlowable() fails with out of memory error in rxjava2
Why does this fails with out of memory error
Observable.fromIterable(IntStream.range(1, 100000).boxed()
.collect(Collectors.toList()))
.toFlowable(...
0
votes
0
answers
230
views
Use OpenApi v3 yaml to generate route and validator with Vertx
I'm in Vertx 4.3.4 with RX java, and I want to initialize my routes with a openapiv3.yaml and especially (the main purpose) validate user input of each declared route in yaml (with the input model too ...
0
votes
0
answers
29
views
Skipping incorrect values with onErrorResume
I have RxJava problem with onErrorContinue() which officialy not exist.
Observable.fromIterable(List.of(1,2,3,4,5))
.flatMap(int -> {
if ( p % 2 == ) { return Observable.error(new RuntimeException(&...
0
votes
1
answer
34
views
Return value from DB operation in Single<Long>
I am adding a record in my database (Room) and it returns the ID of the inserted record. For example, I add a row and it returns the number 5 (which is a Long).
When that operation is complete, I need ...
0
votes
1
answer
58
views
RxJava - Conditional merging operations and asserting exception
I'm having one method which performs multiple conditional validations. I'd merge all validation into stream and assert if any exception occured.
public Observable<Void> performValidation(...
0
votes
1
answer
77
views
Observable.interval() - How can I resume the interval if network call fails?
I have an Observable.interval() that I'm using an SDK to poll an API endpoint every 5 seconds.
So that means when I make the network call, there is a chance that it throws an error.
(usually the first ...
0
votes
3
answers
207
views
RxJava - How to avoid this race condition?
I'm trying to insert some data into the local database on a background thread with a Completeable inside the constructor of my ViewModel
public MainViewModel() extends ViewModel {
public ...
1
vote
0
answers
178
views
RxJava - How to return the last 2 items from a Flowable for a new Observer
I have a Flowable<String> that returns the LATEST set of String. This is part of a library class. Is there a way for me to return the last 2 strings when a new observer subscribes to this ...
0
votes
2
answers
42
views
Combine Singles and generate a data class Single
I have a question around Single and haven't been able to find a good answer for that yet.
I have to return a Single from a method where I get 2 Single sources. The problem is I need to use the output ...
0
votes
1
answer
127
views
RxJava - .andThen() never called after .flatMapCompletable()
I have a Observable with a chained Completeable with a chained Single that is called at an interval of 5 seconds.
public void getCoinPrices() {
disposable = Observable
....
0
votes
0
answers
63
views
RxJava - When to use Disposable vs DisposableObservers?
When would I use a disposable vs a disposable observer? I was always under the assumption that you use a disposable observer and call dispose() when you want to unsubscribe. What's the difference ...
0
votes
0
answers
37
views
D/OkHttp: <-- HTTP FAILED: android.os.NetworkOnMainThreadException Retrofit2 +RxJava2
I'm trying to learn how Retrofit+RxJava work and I'm testing some example. If I call a List of objects I can print on console this list of objects. Here below the code:
Disposable disposable = ...
0
votes
0
answers
169
views
Attempt to invoke interface method ApiInterface.getArea(java.lang.String, java.lang.String)' on a null object reference - RETROFIT + RXJAVA
I'm new on Retrofit+ RxJava. I wrote some app using Volley and nothing else. Now I'm trying to understand how Retrofit + RxJava work. I'm testing them calling some web service I used in Volley.
I read ...
0
votes
0
answers
67
views
Rxjava3 onNext method is executed after a long delay
I use the following code to realize the countdown display at the millisecond level. After onSubscribe is executed, the onNext method is executed nearly one minute later.
This problem occurs ...
0
votes
1
answer
67
views
Split a stream, edit its fields then recombine it to a single stream
I have the following structure
--- Stream A [ A.map1.diff() ] ---
| |
| |
Source --- --- Stream B ...
0
votes
0
answers
212
views
Android. How to handle events with debounce?
I'm using library and handle event from library (for example onUpgrade). The problem is that this event can be called very often, therefore I need handle my onUpgrade event with debounce 3 seconds.
...
0
votes
1
answer
191
views
RxJava fromCallable() and defer() difference in behaviour
I have implement a validate function, sample code are as below:
public class TestObject {
LocalDateTime d1;
LocalDateTime d2;
//getters, setters
}
public class ErrorResult {
String errorMsg;
...
0
votes
1
answer
107
views
rxjava - how to switch to previous stream but also do some work on main thread once first observable is ready?
I have two observables that both make network calls but they depend on each other:
val ob1 = Observable.just(myservice.getNewsArticles())
ob1.flatMap{ newsArticle -> myservice....
0
votes
0
answers
615
views
How to analyze memory consumption when running application inside container
I am running a RxJava-Micronaut with application and sqlite database inside the container. This application is having a scheduled job which process half millions string records from database (it calls ...
0
votes
1
answer
244
views
How can I delay the onSuccess and onError methods in RxJava?
I posted this question about how to delay the onSuccess method in RxJava about 9 months ago. Here is a summary of the question:
The SplashScreenFragment is a fragment that loads data from a server
...
1
vote
0
answers
338
views
ExoPlayer - Player is accessed on the wrong thread with RxJava2
From past developers, I got a large library, which is built on the basis of ExoPlayer, which allows you to listen to audio books.
Everything worked fine until the library itself had to update the ...
0
votes
0
answers
54
views
Using backpressure in observables of cold type?
Since in Hot Observable , we must use backpressure strategy to prevent from crash but why we use backpressure for example in the following examples which are Cold type:
Example 1
// If we do not use ...
0
votes
1
answer
46
views
How to create an Observable inside another Observable to receive part of the data?
By subscribing to getOrderBook I am getting data via Netty and Websocket. The first time a full OrderBook arrives, and then incremental updates follow. As a result, I get the complete OrderBook with ...
0
votes
0
answers
111
views
Android com.androidnetworking.common does not exist
I have issue with Rx2 Networking is not working. I have already added RXjava dependency in Gradle file but still getting this below error.
"error: package com.rx2androidnetworking does not exist
...