Questions tagged [rx-android]
RxJava bindings for Android
1,767
questions
0
votes
1
answer
37
views
Multiple chained API calls to fetch data, but doOnNext of PublishSubject is never reached
I have a problem to understand a chained "RXJava-Retrofit" API call. I got inspired by this and implement this class named ObservationLoader to load the data from the API bucket per bucket. ...
0
votes
1
answer
48
views
RxAndroidBle waiting for response from peripheral when write on it (not long write) in Kotlin
I am trying to write to a peripheral in Android Kotlin using RxAndroidBle. The application writes to the peripheral and then the peripheral responds if this write request is successful, i.e.
According ...
0
votes
0
answers
49
views
How to wait for completion of multiple Observables in RXJava?
I have multiple tasks, each being executed on Schedulers.newThread(). The task is a method, which returns Observable<Long>.
The overall structure looks like this:
public void ...
0
votes
1
answer
70
views
Android - RxJava - Race condition
I am new to the concept of multi-threading and also new to RxJava. I think I ran into a race condition in my Android project.
To be able to demonstrate it better, I downloaded the google codelabs ...
1
vote
1
answer
43
views
RxAndroid: Fetch data from multiple apis
I have a usecase where I get list of userids from 1 Api as a Single<List> and I need to fetch all the users from a different Api which returns Single.
fun fetchUserIds(): Single<List<...
0
votes
1
answer
25
views
Switch back to original thread after executing element of a chain
Is it possible to achieve something like this with RxJava, and if so - how:
There is chain of Rx operators, which is subscribed to with proper subscribeOn and observeOn
Inside the chain, there is a ...
1
vote
1
answer
44
views
How to use RxJava / RxAndroid in Android to make slow network call and update the UI?
I have started reading about RxJava / RxAndroid, but I can't find simple tutorial that covers typical thing, like getting network data and updating UI with the result.
Many tutorials cover scenario ...
1
vote
0
answers
32
views
How to create a stopwatch with Rx counting down to 0?
How can I create a stopwatch with Rx in Kotlinv with Observables, so anything can subscribe to it:
It shall remain even when I put the app in background
I start the Observable with anything I ...
0
votes
0
answers
163
views
How do I wait for a void function to finish executing before triggering a completable in Android?
I'm very new to RxJava/RxAndroid and I'm very confused with how to achieve this workflow:
Trigger void function
Once it completes, provide some sort of callback to start a Completable function.
I ...
0
votes
1
answer
47
views
How to signal an infinite observable to stop/continue emission?
Problem description
I writing an Android application in Java to handle RFID reading based on some proprietary library and hardware. The RFID reader has a JNI library, which acts as an API to the ...
0
votes
0
answers
138
views
Memory leaks in general in RxJava
I wanted to ask something with regards to memory leaks in general in RxJava.
Once a Single or Completable's subscription terminates (i.e. after onSuccess or onError, etc. is called), is it safe to ...
0
votes
0
answers
44
views
ThrottleLast in RxJava : Unexpected Behavior
I faced the unexpected behavior when I tested the sample code as follows.
@Test
public void test_throttleLast() {
Observable.fromArray("0", "1", "2", "3", &...
1
vote
1
answer
77
views
Single<String> at rxjava
I want to get an output string from the server with the help of RXJava and RetroFit Reader, but RXJava does not accept the string!
file api:
interface Api {
@POST("registerNumber.php")
...
0
votes
1
answer
77
views
RxJava real World Usecase Scenario
Currently im learning how to use RxJava. I fully understand the concept of the reactive Programming paradigma where the programm needs to react to certain types of changes (Userinputs, Sensordata, etc....
0
votes
0
answers
150
views
RxJava 2 Zip/Combine/FlatMap operators
I'm trying to find a proper RxJava 2 operator for my specific need.
I have 2 server requests.
val singletonOne = repository.loadData(requestOne) // Returns Single
val singletonTwo = repository....
0
votes
2
answers
348
views
How to handle Exception in map() RxJava
I'm calling an API which throws 404 status code and due to that app gets crashed. The code snippet is mentioned below:
fun loadAndSavedata(
type: Type,
bookmark: String? = null,
): Single<...
0
votes
0
answers
48
views
rxAndroid Subscribing while app is in the background
I am currently working on an App which relies on a Wifi Connection to some devices.
We have a subscribe set up in a view model to detect the device connection status from an observable, e.g. Connected ...
0
votes
1
answer
45
views
How to manage error for each item when insert list of data to room with rxjava
@Dao
interface NoteDao {
@Insert(onConflict = OnConflictStrategy.ABORT)
fun insert(note: Note):Completable
@Insert(onConflict = OnConflictStrategy.ABORT)
fun insert(notes: List<...
2
votes
1
answer
54
views
rxjava chain observalbes dynamiclly
I have a chained observable that I created like this:
Disposable disposable = currentUsedAdapter.connect(ip)
.observeOn(AndroidSchedulers.mainThread())
.concatMap(fallbackAdapter(...
1
vote
1
answer
133
views
Sending data over the air and after completion end the operation using RxAndroidBLE
I am trying to send the 128 bytes of the block to BLE Controller using the RxAndroidBle library. the flow to send data from mobile to BLE controller is as follows
Connect with BLE Controller
Start ...
0
votes
1
answer
190
views
The app is freezing for a little bit when using Retrofit with RxJava
JSON
[
{
"countryName":"..."
},
{
"countryName":"..."
},
{
"countryName":"..."
} //etc... to 195 ...
0
votes
1
answer
338
views
Cannot resolve method 'subscribe(io.reactivex.rxjava3.core.SingleObserver<okhttp3.ResponseBody>)'
SingleObserver < ResponseBody > singleObserver = new SingleObserver < ResponseBody > () {
@Override
public void onSubscribe(@io.reactivex.rxjava3.annotations.NonNull Disposable d) {...
0
votes
1
answer
198
views
rxjava ObservableCreate with emitter vs rxrelay PublishRelay
I'm a bit new to reactive programming so I want to start with explaining my use case and what I did, then the problem with my solution and what I think is the answer but I'm not sure.
So this is my ...
0
votes
0
answers
420
views
Failed to parse error response, Expected BEGIN_OBJECT but was STRING at line 1 column 1 path
I have this type of error response
{
"success": false,
"code": 400,
"message": "Validation Error.",
"data": {
"mobile&...
0
votes
0
answers
142
views
Rxjava error handling:App not crash after subscription ends
while learing rxjava/rxandroid i have came across one scenario. please help me to understand it.
please check below code.
val observable:Observable<Int> = Observable.create {
Log.d(...
0
votes
1
answer
51
views
Handle response.body == null in RX
i use Rx in android below
repository.getUserList()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({ response ->
...
0
votes
1
answer
556
views
Android - WorkManager - Result.success() called too many times
I'm stuck on a problem with my app.
I'm trying to upload some photos to a cloud and then, I'll show to the user a list of url to copy, in order to use them in a second time.
I'm using RxWorker for ...
1
vote
1
answer
120
views
How to ignore failed request and continue responsing to the next requests?
I have a function that takes an article id list to set on the adapter. Everything works fine until at least one of the requests fails. Then the returned list is empty. How to make it ignore a failing ...
-1
votes
1
answer
524
views
RxJava Run A Task on another thread
I'm using RxJava3 Observers and Observables. But i have a problem.
I have attached a screenshot below, please see the Toast on the bottom. I used Thread.currentThread().toString() And i got the Main, ...
1
vote
1
answer
86
views
don't re-execute request while user is clicking repeatedly on fetch data button using rxbinding and rxjava
I have a RxView and I have set the click observer, I don't wanna always make new request per click.
The thing that I wanna is to ignore user clicks when the fetching data request is in progress only ...
1
vote
1
answer
785
views
Map an object that having list inside to another object with the list
I am trying to map an object1 to another object2. but the object1 have a list in it.
This is my code. but when but I am getting error saying can not be cast.
This is the object I am getting from API
...
0
votes
2
answers
463
views
Schedulers.computation() v/s Schedulers.io() in RxJava/RxAndroid
I have read through so many answers on SO like the following use-cases-for-rxjava-schedulers , what-is-the-difference-between-schedulers-io-and-schedulers-computation , rxjava2-schedulers-io-vs-...
0
votes
1
answer
157
views
BehaviorSubject with nullable type?
What I'm looking for is something like BehaviorSubject<Object?>. Unfortunately BehaviorSubject throws NullPointerExceptions even if the type is nullable.
As per the docs, BehaviorSubject doesnt ...
3
votes
1
answer
302
views
How to filter data Paging 3 Android?
I would like to filter data from the current response in Paging 3 using PagingRx.
I have tried as mention in Paging Documentation
Used Libraries
def paging_version = "3.0.1"
//Paging
...
1
vote
1
answer
99
views
RXJava Android make multiple calls with different lengths
I need to get the camera ID from the server, then get the events of this camera by ID, and at the end get the image by ID.
Then, all this needs to be combined into a UI post {Camera name - image url - ...
0
votes
0
answers
174
views
Two-way databinding UI control value to domain layer in android
So, I'm learning some architecture stuff and I'm trying to stick to a strict domain model where I don't depend on any android components. I'm using rxjava in my domain and I'm trying to have changes ...
0
votes
0
answers
65
views
RxJava Retrofit make multiple requests for id
I have JSON
{ "cameras" : [
{
"archives" : [
{
"accessPoint" : "xxxx",
"default" : true,
"...
0
votes
1
answer
81
views
PackageManager$NameNotFoundException for rxAndroidBle
For version 1.12.1, I am getting a runtime exception after upgrading to this version from 1.10.5
2021-07-16 15:30:16.588 22665-22665/co.(appname).staging E/AndroidRuntime: FATAL EXCEPTION: main
...
0
votes
0
answers
92
views
RxJava . flatMap returning SingleList instead List<Object>
I have this chunk of code. I am trying to get JSONObjects from JSONArray and then turn it to List but getting singlelist instead of what i needed. Maybe i misunderstood something?(I'm new to rxJava)
...
1
vote
0
answers
196
views
Rxjava `2.x` Crash when an exception is thrown
RxJava version
2.2.19
Operating platform
Android 8~11
Question
Firebase reported that Flowable.error(new IllegalStateException("Illegal status")) crashed.
It seems that what is thrown by the ...
1
vote
1
answer
519
views
E/AndroidRuntime: FATAL EXCEPTION: RxCachedThreadScheduler-3 Callable returned a null value
Inside my Activity B I call an async method called myASYNC that gets data from an API (the amount of data is big enough that it takes a few seconds to load all of it). If I click the Android back ...
0
votes
2
answers
1k
views
Android periodic task every 5 minutes
I need to download some data from my webservice every 5 minutes (user is allowed to change this interval time, but the minimum is every 5 min), and because Android's WorkManager is aimed to work with ...
0
votes
1
answer
185
views
Room Database - How to return entire row after insert?
I have query that inserts a row
@Dao
public interface NoteDao {
@Insert
Long insert(Note note);
}
I'm using RxJava to perform the query on the background thread:
public void insert(Note ...
0
votes
0
answers
308
views
Kotlin lambda function in RxJava subscription captures this reference even when not used
This is something I have unfortunately been stuck on for a while, and is an issue I did not see coming. But my understanding of both the LeakCanary report and the generated Kotlin Bytecode is that ...
1
vote
1
answer
110
views
Wondering what is the best way to continue the following Rx chain ,where I need to decide to call either flatmap or switchmap?
I have a Flowable object Flowable<Data>based on the Data property I need to continue the chain either using flatmap or switchmap operator and where I will call the method which returns Flowable....
-1
votes
2
answers
323
views
RxJava if/else with multiple chain calls
I have a webservice call that return an object in which there is a parameter that indicates whether the operation ended successfully or not, so I would like to filter it (kind of if/else statement) ...
0
votes
0
answers
114
views
RxAndroidBle - writeCharacterstics failing in android naugat
I am trying using RxAndroidBLE API to scan, connect and do write operations on BLE device. I am using following code to do writeCharacterstic operation
bluetoothGattCharacteristics.setWriteType(...
2
votes
1
answer
97
views
What happens when an expensive operation is happening and thread freezes for longer than RxJava Interval period
I am using RxJava Interval Like this:
compositeDisposable.add(
Observable.interval(1, TimeUnit.SECONDS)
.flatMap(tick -> {
return Observable.just(doWork(tick));
})
...
0
votes
0
answers
58
views
Android Rx Buffer Force Emit
I'm writing a file logging utility, using Rx buffer, for my Android app.
val logBuffer = PublishSubject.create<String>()
logBuffer
.observeOn(Schedulers.computation()...
0
votes
1
answer
43
views
RX android Single<Boolean> not subscribing to Schedulers.io() thread but to main thread instead when doing ROOM query
I am not very experienced in using android RX. I am checking if an entity exits in ROOM using this query
this is in my DAO
@Query("SELECT EXISTS(SELECT * FROM contacts WHERE number = :...