Giter Site home page Giter Site logo

kaushikgopal / rxjava-android-samples Goto Github PK

View Code? Open in Web Editor NEW
7.6K 366.0 1.4K 1.16 MB

Learning RxJava for Android by example

License: Apache License 2.0

Java 89.60% Kotlin 10.40%
rxjava java learning-rxjava example sample thread concurrency reactive-programming reactive

rxjava-android-samples's Issues

AndroidObservable

You should always use AndroidObservable to bind the source sequence to the activity/fragment. This way you ensure that if the activity is scheduled to finish no notifications will be forwarded, plus it already observes on Android UI main thread.

for example:

subscription = AndroidObservable.bindActivity(this, YourObservable).subscribe();

AndroidObservable bindActivity() or bindFragment() both return an observable product of yours, so you can treat it normally as any observable. AndroidObservable has other interesting methods such as fromBroadcast() which creates an observable that wraps a BroadcastReceiver and emit received intents.

Rxbus + Sticky Events?

What about making the events sticky?

If I use rxbus with android's sharing mechnism how will I get the event in the activity where
the shared info is received.

The event will be sent before the activity is opened...do I have to persist the event?
would'nt that make a bus irrelevant?

Observables Context??

Hi Kaushik,
It would be great if you can help with Observables,like
Which observable ,i can make use of when i was dealing with AsyncTask
and Which Observable I can make use of Login and SignUP and
Difference between and Disposable and Composite Disposable?

Does RotationPersist leak the Activity?

If I add LeakCanary by just putting

    LeakCanary.install(getApplication());

in the MainActivity's onCreate(), then

    debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1' 
    releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1' 

to the build.gradle dependencies, I find that hitting BACK during the counter increment reports a "suspected leak" in the log and the LeakCanary "Brr..." screen comes up. In fact, you also get it if you just rotate a few times when the counter is running but exit after it has completed normally. Is this a real leak?

01-15 16:37:53.960 4308-4324/com.morihacky.android.rxjava I/art: hprof: heap dump "/storage/sdcard/Download/leakcanary/suspected_leak_heapdump.hprof" starting...

image

Configuration Changes

Device rotation in any of the examples fragments will return to the MainFragment.
just checking the savedInstanceState before replacing the mainFragment in mainActivity would be sufficient.

how to tell zip operator to execute observables one after another ?

This is not a issue on your demonstration code. More over required suggestion and request to add a example.

Based on one network call, i needed to make multiple network calls to finish a particular action taken by user and update the UI. I have used flatmap and zip to acheive this. Thanks to the demo you have put. It helped.

The problem i am facing is when making multiple network calls based on first network call response, zip operator executes every observables in parallel ( which is what expected) which at one point server is rejecting with maximum query per second error. How to execute the observables given to zip operator one after another ( serially). or should i use some other operator to execute serial. Any advise ?
Also if you could add some demonstration on this would be useful for others. As i feel this is common use case in android app development.

http://stackoverflow.com/questions/26695099/compose-multiple-network-calls-rxjava-android/26696774#26696774

Thanks.

What does RotationPersist1WorkerFragment and RotationPersist2WorkerFragment do?

First of all, Thank you so much for these samples. I am new into android and i am working my way around advance stuff on my own. I am trying to adopt the approach you are using in this sample in my new app. I have gone through the code and i found these two fragments RotationPersist1WorkerFragment and RotationPersist2WorkerFragment. I think these two fragments are for to keep the track of the fragments on back press(correct me if i am wrong). Since i am new to this. Would you please like to explain further about it?
Why are there two worker fragments? when only one could have done the same work.
Looking forward to hear back from you.
Thanks much.

orientation change messes it up

You should add retained fragments (see http://www.androiddesignpatterns.com/2013/04/retaining-objects-across-config-changes.html) or http://developer.android.com/reference/android/content/AsyncTaskLoader.html to retain the REST calls when the activity is restarted on device rotation. Right now, on orientation change, you get various errors in logcat besides giving a sub-optimal experience to the user. E.g.:

09-22 15:51:19.793 9639-9639/com.morihacky.android.rxjava E/ViewRootImpl﹕ sendUserActionEvent() mView == null
09-22 15:51:28.173 9639-9639/com.morihacky.android.rxjava E/RetrofitFragment﹕ woops we got an error while getting the list of contributors along with full names
retrofit.RetrofitError: 403 Forbidden

Memory leak

Hi Kaushik, thanks for yours examples about RxJava. I`ve just started learning it. I investigated RxJava with Retrofit, and found an issue. When the request being done to server, an exception is thrown with 403 error. onError called, an exception logged. looks Ok.
The issue is - when I close the app with back button, and open again, and do the request again, exception is thrown, and 2 errors was logged. Do the same steps, onError was called, 3 erros was logged, etc. Memory leak occurs.

Firstly - it seems strange, the Observable finished with an error, onError was called, app was closed with back button, onDestroy was called, all objects should be garbage collected.Isn't it ?

Ok, I tried to call unsubscribe on OnDestroy, the issue still reproduce.
I googled the issue and found workaround using WeakReference. It looks awkwardly.

What is your opinion about this ? Or, I did something wrong ?

After value change -> execute once

After getting a specfic value from an Observable, I would like to execute a method only once. -> on Completed()

How could this be possible?

getRxBusSingleton();

Your calling

_rxBus = ((MainActivity) getActivity()).getRxBusSingleton();

but I dont see this method in RxBus.java??

edit:

I see it's in the host activity. But why isn't it in the RxBus class?

Can you explain the getsingleton call and science behind it?

thanks!

Can not subscribe to observable again once the app is unsubscribed with FormValidationCombineLatestFragment

Hi,

First of all, thank you for the great samples, Kaushik. Very useful for RxJava beginners.

I have questions about the title.
I found out that in Form Validation with CombineLatest sample (FormValidationCombineLatestFragment.java), observer can not subscribe to observable again once the app goes into background by pressing "HOME" button and then returns to foreground.

I thought this is because _subscription.unsubscribe() is call at onPause() and _combineLatestEvents() is called at onCreateView().
So, I changed the code as below so that observer are subscribed again when the app comes to foreground.

// FormValidationCombineLatestFragment.java
@Override
public void onResume() {
    super.onResume();
    _combineLatestEvents();
}

@Override
public void onPause() {
    super.onPause();
    if (_subscription != null) {
        _subscription.unsubscribe();
    }
}

However, this did not work.
Then, I changed the code to call _subscription.unsubscribe() at onDestroy(), and finally it worked as I expected.

@Override
public void onDestroy() {
    super.onDestroy();
    if (_subscription != null) {
        _subscription.unsubscribe();
    }
}

So my question is,

  1. Is calling _subscription.unsubscribe() at onDestroy() a right decision?
  2. Why calling _combineLatestEvents() at onResume() can not re-subscribe to observable?

It would be helpful if anyone has solution for these questions.
Thank you

Observing a single Observable in multiple fragments/activities

To observe the same Observable (results of a Retrofit call, for example) in multiple fragments or activities, is it normal to subscribe to the Observable in the same scope where it exists (retained fragment, singleton, whatever) in order to keep the calls from terminating (e.g. chained network calls with flatMap()) and create a new Subscription to the Observable in each interested fragment/activity? Or is there a better approach?

feat: material design updates

While the draw to these samples are the examples and .java code per say, it would be nice to have the app not look so dated.

Not looking for anything super fancy, just a nice update to the material design defaults

Sticky event bus

Hi.
First of all, thank you for the great samples, That's awesome!

I would like to get some advice. I really want to know how to implement sticky event with Rxbus. Any operator can reach it? I can't find any example for that, should i custom operator by .lift( )? If you feel it, what would you do?

I'm really really really confused. : (

Thanks.

Gist link broken

The example under WIP for the cache/concat has a gist link that is broken

CacheMerge example updates entire adapter for each onNext

Hi,

Was checking out this repo (which is awesome btw)
and noticed that the CacheMerge example does some unnecessary updating (I think).

For each onNext() the entire adapter will be cleared and updated,
while there is only added one 'contributor' at a time.

This looks a bit inefficiently to me.

@Override
public void onNext(Pair<Contributor, Long> contributorAgePair) {
...
_adapter.clear();
_adapter.addAll(getListStringFromMap());
}

Only adding the 'Next' 'contributor' could be better or not?
@Override
public void onNext(Pair<Contributor, Long> contributorAgePair) {
...
String rowLog = String.format("%s [%d]", contributor.login, contributor.contributions);
_adapter.add(rowLog);
}

Wiki Pages for examples

Do you think that having github wiki page for each example would help people new to Rx understand the examples better? I'm thinking something like Code Path. Then we could use resource like http://rxmarbles.com/ to help visualize the example.

Exceeds Dex Limit of 64k in its current state.

I just cloned the repo and tried to build

./gradlew clean assemble  

The build fails with the following error:

Dex: The number of method references in a .dex file cannot exceed 64K.

Is this a known issue? I can try and submit a pull request to fix this soon. I just wanted to check before a pull request.

force close on sample bg work

I click on button several times then press back and go to first page. then this error occurs:
at com.morihacky.android.rxjava.fragments.ConcurrencyWithSchedulersDemoFragment$2.onCompleted(ConcurrencyWithSchedulersDemoFragment.java:100)
if you unsibscribe the listener why this happen? can fix this issue pls :)

rxbus in long running sticky service

I'm super new to rx thinking, it took me like 4-5 mos to get this far in
implementing the future in my code so bare w/ me...

is it ok to use rxbus in a service?

I have network data incoming from a background service constantly, I want to send it on its way via rxbus to fragments, quite possibly even store the data based on certain conditions, along its route.

are there any issues thats a apparent with that use case?

i'm attempting all this now.

java.util.concurrent.ExecutionException in Volley example causes an exception in Rx java

Hello,

I've just started learning RxJava and I'm going through your examples (which are great, btw).

I've been using Volley a lot, so I wanted to try out the Volley example, however, I get an exception there from time to time:

07-07 11:03:13.327 935-992/com.morihacky.android.rxjava E/routes: com.android.volley.TimeoutError 07-07 11:03:13.331 935-935/com.morihacky.android.rxjava E/AndroidRuntime: FATAL EXCEPTION: main java.lang.IllegalStateException: Fatal Exception thrown on Scheduler.Worker thread. at rx.android.schedulers.LooperScheduler$ScheduledAction.run(LooperScheduler.java:114) at android.os.Handler.handleCallback(Handler.java:615) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4745) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) at dalvik.system.NativeStart.main(Native Method) Caused by: rx.exceptions.OnErrorFailedException: Error occurred when trying to propagate error to Observer.onError at rx.observers.SafeSubscriber._onError(SafeSubscriber.java:192) at rx.observers.SafeSubscriber.onError(SafeSubscriber.java:120) at rx.internal.operators.OperatorObserveOn$ObserveOnSubscriber.checkTerminated(OperatorObserveOn.java:264) at rx.internal.operators.OperatorObserveOn$ObserveOnSubscriber.call(OperatorObserveOn.java:207) at rx.android.schedulers.LooperScheduler$ScheduledAction.run(LooperScheduler.java:107) at android.os.Handler.handleCallback(Handler.java:615)  at android.os.Handler.dispatchMessage(Handler.java:92)  at android.os.Looper.loop(Looper.java:137)  at android.app.ActivityThread.main(ActivityThread.java:4745)  at java.lang.reflect.Method.invokeNative(Native Method)  at java.lang.reflect.Method.invoke(Method.java:511)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)  at dalvik.system.NativeStart.main(Native Method)  Caused by: rx.exceptions.CompositeException: 2 exceptions occurred. at rx.observers.SafeSubscriber._onError(SafeSubscriber.java:192)  at rx.observers.SafeSubscriber.onError(SafeSubscriber.java:120)  at rx.internal.operators.OperatorObserveOn$ObserveOnSubscriber.checkTerminated(OperatorObserveOn.java:264)  at rx.internal.operators.OperatorObserveOn$ObserveOnSubscriber.call(OperatorObserveOn.java:207)  at rx.android.schedulers.LooperScheduler$ScheduledAction.run(LooperScheduler.java:107)  at android.os.Handler.handleCallback(Handler.java:615)  at android.os.Handler.dispatchMessage(Handler.java:92)  at android.os.Looper.loop(Looper.java:137)  at android.app.ActivityThread.main(ActivityThread.java:4745)  at java.lang.reflect.Method.invokeNative(Native Method)  at java.lang.reflect.Method.invoke(Method.java:511)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)  at dalvik.system.NativeStart.main(Native Method)  Caused by: rx.exceptions.CompositeException$CompositeExceptionCausalChain: Chain of Causes for CompositeException In Order Received => at android.util.Log.getStackTraceString(Log.java:314) at android.util.Slog.e(Slog.java:77) at com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:72) at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693) at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690) at rx.android.schedulers.LooperScheduler$ScheduledAction.run(LooperScheduler.java:118) at android.os.Handler.handleCallback(Handler.java:615)  at android.os.Handler.dispatchMessage(Handler.java:92)  at android.os.Looper.loop(Looper.java:137)  at android.app.ActivityThread.main(ActivityThread.java:4745)  at java.lang.reflect.Method.invokeNative(Native Method)  at java.lang.reflect.Method.invoke(Method.java:511)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)  at dalvik.system.NativeStart.main(Native Method)  Caused by: java.util.concurrent.ExecutionException: com.android.volley.TimeoutError at com.android.volley.toolbox.RequestFuture.doGet(RequestFuture.java:117) at com.android.volley.toolbox.RequestFuture.get(RequestFuture.java:88) at com.morihacky.android.rxjava.volley.VolleyDemoFragment.getRouteData(VolleyDemoFragment.java:133) at com.morihacky.android.rxjava.volley.VolleyDemoFragment.access$000(VolleyDemoFragment.java:39) at com.morihacky.android.rxjava.volley.VolleyDemoFragment$1.call(VolleyDemoFragment.java:83) at com.morihacky.android.rxjava.volley.VolleyDemoFragment$1.call(VolleyDemoFragment.java:79) at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:46) at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:35) at rx.Observable.unsafeSubscribe(Observable.java:8452) at rx.internal.operators.OperatorSubscribeOn$1.call(OperatorSubscribeOn.java:94) at rx.internal.schedulers.CachedThreadScheduler$EventLoopWorker$1.call(CachedThreadScheduler.java:222) at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:442) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305) at java.util.concurrent.FutureTask.run(FutureTask.java:137) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:150) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:264) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) at java.lang.Thread.run(Thread.java:856) Caused by: com.android.volley.TimeoutError at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:147) at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:114)

The cause seems to be a timeout error in Volley; the site which is called (http://www.weather.com.cn/adat/sk/101010100.html) seems to be slow to respond on occasion. I've even had a request executing for 10+ seconds (and Volley default timeout is 5 seconds). The timeout error causes ExecutionException which should be caught and handled by the try/catch block in newGetRouteData method, however this causes something called a "CompositeException" which then kills the app.

I would also suggest avoiding TimeoutErrors even if this exception is solved; maybe use another site, something hosted by google or the like, or set a larger timeout. For instance, this should do the trick, before adding req to request queue:

req.setRetryPolicy(new DefaultRetryPolicy( (int) TimeUnit.SECONDS.toMillis(60), 1, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));

This sets timeout to 60 seconds, with 1 retry in case of a failure. Although just picking a faster site would probably be enough.

P.S. variable priority in getRoutData() is never used

something strange about RxBus ?

for example: when there are 2 Observers subscribe the RxBUS, the RxBus will send event 4 times, that means ,you will receiver the event 2 times on each Observer.

even if ,I do this ,It sames does not work ,

.debounce(100, TimeUnit.MILLISECONDS)//事件去重
                //.distinct()
                .distinctUntilChanged()
                .subscribe(new Action1<Object>() {
                    @Override
                    public void call(Object event) {
                        Log.e("Rxbus", "call() called with: " + "event = [" + event + "]");
                        eventLisener.dealRxEvent(event);
                    }
                }));

can you help me ,thanks

String is van empty or null

Hi Kaushik,

I like your example of the form validation, thanks for that!

Is there a reason why you use the
com.google.common.base.Strings.isNullOrEmpty instead of the TextUtils.isEmpty() in there?

Question On Cache and retaining the observable

I saw your video on Rx Java on youtube. From what i understand the observable needs to be retained during orientation change. One way to do that is in a retained fragment without ui.

I attended a talk on android organized By B.A.U.G. In the sample they used dagger, retrofit and EventBus. The point was to have model, view and presenter. In the example they use a singleton to retain the Observable and they use cache operator to cache the data. There is a problem if you do not have network connection your cache is empty and you go back to previous activity and come back you get the same empty cache.

I have been going through blogs, videos and i still don't understand how to handle it in a clear way.

Sample Project https://github.com/anupcowkur/MVPSample.

So how do i deal with this.

Sorry! if this is not the right place to raise the issue. I would be happy to put this in the right place. In fact i did ask this question on Rx java group and i haven't got an answer.

RxJava 1 branch

There's still plenty of RxJava users who haven't migrated to RxJava 2, please provide RxJava 1 branch. Sure you can checkout to #e200ab but I think it would be easier just to switch a dedicated branch.

Enhanced RxBus

Nice repo! Also really simple and easy approach to achieve Pub-Sub pattern in RxBus.

would you consider enhancing the example with smth like https://github.com/apptik/rxHub ?
I would be more than happy to provide a PR.

Tests

Would you be interested in me writing at least a few tests to confirm RxJava samples provide expected behaviour? Once we have tests in place, we can make other changes, such updating to latest dependencies, with much greater confidence.

This would probably require some refactoring of existing code. I can start with just one example to check if you are happy with the approach.

gc overhead limit exceeded?

Hi, I just want to see your example however I am having an error when running your example. here it is.

Error:java.lang.OutOfMemoryError: GC overhead limit exceeded
Error:	at java.util.Arrays.copyOfRange(Arrays.java:3664)
Error:	at java.lang.String.<init>(String.java:207)
Error:	at java.lang.StringBuilder.toString(StringBuilder.java:407)
Error:	at com.android.dx.rop.type.Prototype.withFirstParameter(Prototype.java:370)
Error:	at com.android.dx.rop.type.Prototype.intern(Prototype.java:180)
Error:	at com.android.dx.cf.iface.StdMethod.<init>(StdMethod.java:46)
Error:	at com.android.dx.cf.direct.MethodListParser.set(MethodListParser.java:81)
Error:	at com.android.dx.cf.direct.MemberListParser.parse(MemberListParser.java:217)
Error:	at com.android.dx.cf.direct.MemberListParser.parseIfNecessary(MemberListParser.java:108)
Error:	at com.android.dx.cf.direct.MethodListParser.getList(MethodListParser.java:54)
Error:	at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:551)
Error:	at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
Error:	at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
Error:	at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
Error:	at com.android.dx.command.dexer.Main.parseClass(Main.java:772)
Error:	at com.android.dx.command.dexer.Main.access$1500(Main.java:85)
Error:	at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1700)
Error:	at com.android.dx.command.dexer.Main.processClass(Main.java:755)
Error:	at com.android.dx.command.dexer.Main.processFileBytes(Main.java:723)
Error:	at com.android.dx.command.dexer.Main.access$1200(Main.java:85)
Error:	at com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1653)
Error:	at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
Error:	at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
Error:	at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
Error:	at com.android.dx.command.dexer.Main.processOne(Main.java:677)
Error:	at com.android.dx.command.dexer.Main.processAllFiles(Main.java:569)
Error:	at com.android.dx.command.dexer.Main.runMultiDex(Main.java:366)
Error:	at com.android.dx.command.dexer.Main.run(Main.java:275)
Error:	at com.android.dx.command.dexer.Main.main(Main.java:245)
Error:	at com.android.dx.command.Main.main(Main.java:106)

Rxjava 2 with Android new architecture components

i think using rxjava with android architecture component will be good mix especially with the new "VIEW MODEL" class and using that component for retaining that rxjava stream instead of retain fragment and reconnecting it when activity and fragment get recreated after orientation change. do u have any plan for adding this examples

Long operation doesn't work on orientation change

If I "start long operation" and rotates the screen, app throws this exception:
com.morihacky.android.rxjava W/System.err﹕ java.lang.InterruptedException
com.morihacky.android.rxjava W/System.err﹕ at java.lang.VMThread.sleep(Native Method)
com.morihacky.android.rxjava W/System.err﹕ at java.lang.Thread.sleep(Thread.java:1013)
com.morihacky.android.rxjava W/System.err﹕ at java.lang.Thread.sleep(Thread.java:995)
com.morihacky.android.rxjava W/System.err﹕ at com.morihacky.android.rxjava.ConcurrencyWithSchedulersDemoFragment._doSomeLongOperation_thatBlocksCurrentThread(ConcurrencyWithSchedulersDemoFragment.java:143)
com.morihacky.android.rxjava W/System.err﹕ at com.morihacky.android.rxjava.ConcurrencyWithSchedulersDemoFragment.access$100(ConcurrencyWithSchedulersDemoFragment.java:33)
com.morihacky.android.rxjava W/System.err﹕ at com.morihacky.android.rxjava.ConcurrencyWithSchedulersDemoFragment$1.call(ConcurrencyWithSchedulersDemoFragment.java:68)
com.morihacky.android.rxjava W/System.err﹕ at com.morihacky.android.rxjava.ConcurrencyWithSchedulersDemoFragment$1.call(ConcurrencyWithSchedulersDemoFragment.java:60)
com.morihacky.android.rxjava W/System.err﹕ at rx.Observable$2.call(Observable.java:270)

GUI elements must not be accessed from non-main threads

As far as I understand the following code from DebounceSearchEmitterFragment.java#L76:

_disposable = RxJavaInterop.toV2Observable(RxTextView.textChangeEvents(_inputSearchText))
              .debounce(400, TimeUnit.MILLISECONDS)// default Scheduler is Computation
              .filter(changes -> isNotNullOrEmpty(_inputSearchText.getText().toString()))
              .observeOn(AndroidSchedulers.mainThread())
              .subscribeWith(_getSearchObserver());

filter() accesses the GUI element _inputSearchText, which it must not do: see StackOverflow: Is it okay to read data from UI elements in another thread?

Instead the text should be read from the change-event like this:
.filter(changes -> isNotNullOrEmpty(changes.text().toString()))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.