Questions tagged [rx-android]

RxJava bindings for Android

specific bindings for . RxAndroid module adds a number of classes to RxJava that make writing reactive components in Android applications easy and hassle free.

RxAndroid is open sourced and available under the Apache License, Version 2.0


Related tags

1768 questions
18
votes
2 answers

What is the proper way to handle subscriptions in RxJava/RxAndroid for an Activity Lifecycle?

I am just getting started on RxJava/RxAndroid. I want to avoid context leaks so I created a BaseFragment like so: public abstract class BaseFragment extends Fragment { protected CompositeSubscription compositeSubscription = new…
Sree
  • 2,727
  • 3
  • 29
  • 47
17
votes
2 answers

Updating fragment from Activity Using Rxjava Android

I have a simple use case where: Activity1 create a fragment1 fragment1 after creation notify to activity that it is created and update its activity1 views. activity1 after getting notification update fragment1 views. I am using rxandroid ,…
17
votes
2 answers

Why should one consider using AndroidObservables in RxJava

As i understand AndroidObservable helps ensure that : a Subscriber always observes on the main thread when a fragment/activity is detached/stopped, then the observation stops immediately, and framework related components (like ui textviews etc.)…
KG -
  • 7,130
  • 12
  • 56
  • 72
16
votes
4 answers

Filter list of objects in RxJava

I am trying to filter the list on the basis of it's property. For example, Sensors class has a property isActive and I want to get all the objects with isActive as true but I am unable to do it. I tried different ways but I didn't find the solution.…
16
votes
1 answer

Testing RxBinding RxSearchView

Background public Observable> search(SearchView searchView) { return RxSearchView.queryTextChanges(searchView) .filter(charSequence -> !TextUtils.isEmpty(charSequence)) .throttleLast(100,…
Graham Smith
  • 25,627
  • 10
  • 46
  • 69
16
votes
5 answers

How to handle Item clicks for a recycler view using RxJava

I was interested to find out what is the best way to respond to a item click of a recycler view. Normally I would add a onclick() listener to the ViewHolder and pass back results to the activity/fragment through a interface. I thought about…
J Whitfield
  • 755
  • 11
  • 22
16
votes
1 answer

RxAndroid textview events called automatically before text change events

I used rxandroid for debounce operation on an edittext search I used private void setUpText() { _mSubscription = RxTextView.textChangeEvents(searchStation)// .debounce(500, TimeUnit.MILLISECONDS)// default Scheduler is…
George Thomas
  • 4,566
  • 5
  • 30
  • 65
16
votes
1 answer

Stack overflow when using Retrofit rxjava concatWith

I want to handle pagination in Retrofit using rxjava Observable. I followed the advice from another question. I have more than 100 pages that needs to be fetched, but chain fails around the 20th page and stops any further subscription to the…
Bhuvan
  • 285
  • 1
  • 3
  • 11
15
votes
2 answers

Unable to delete old javaCompile action, maybe the class name has changed

I am learning RxJava. For that i followed droidcon talk video on RxJava. The instructor has given repo link for the project he was using. I cloned the repo when i try to build project in my machine. I get this error Error:Unable to delete old…
Zeeshan Shabbir
  • 6,704
  • 4
  • 38
  • 74
15
votes
2 answers

Rx - How to unsubscribe automatically after receiving onNext()?

How to unsubscribe automatically after receiving onNext() ? For now I use this code: rxObservable .compose(bindToLifecycle()) // unsubscribe automatically in onPause() if method was called in onResume() .subscribe(new Subscriber() { …
Siarhei Sinelnikau
  • 423
  • 1
  • 6
  • 12
15
votes
1 answer

Why does subscribe not executed in a new thread?

I have task like this: Observable.just(getMessagesFromDb()). subscribeOn(Schedulers.newThread()). observeOn(AndroidSchedulers.mainThread()). subscribe(incomingMessages -> { //do something }); where getMessagesFromDb is method…
wttek
  • 173
  • 1
  • 7
14
votes
1 answer

Retrofit Call enqueue method or Rxjava

As Retrofit docs represent Call enqueue method in Retrofit is : Asynchronously send the request and notify callback of its response or if an error occurred talking to the server, creating the request, or processing the response. and Rxjava…
alizeyn
  • 2,300
  • 1
  • 20
  • 30
14
votes
2 answers

doOnError does not catch the exception

I am just getting started with RxJava, but maybe something did not click yet. 1. Integer[] items = {1, 2, 3, 0, 0, 4, 5, 6, 1}; Observable.from(items) .map(this::invert) .subscribe(i -> Log.d(LOG_TAG, "Inverted: " + i), t ->…
thyago stall
  • 1,654
  • 3
  • 16
  • 30
14
votes
4 answers

RxJava + Retrofit + polling

I have a Retrofit call and want to recall it every 30sec. To do that I use an Observable.interval(0, 30, TimeUnit.SECONDS) Observable .interval(0, 30, TimeUnit.SECONDS) .flatMap(x -> RestApi.instance().getUsers()) …
Ralph Bergmann
  • 3,015
  • 4
  • 30
  • 61
13
votes
6 answers

android rxjava sort list with comparator class

I started to use rxjava with my android projects. I need to sort returning event list from api call. I wrote comparator class to sort list : public class EventParticipantComparator { public static class StatusComparator implements…
okarakose
  • 3,692
  • 5
  • 24
  • 44