Adding TextWatcher on EditText using Rxjava and RxBinding

In this tutorial we will be adding TextWatcher on an EditText using RxBinding. RxBinding is a set of libraries that allow you to react to user interface events via the RxJava paradigm . This post is included in series of post which will cover RxJava in detail.


 

[su_button url=”https://github.com/androidsrc/RxJavaSample” target=”blank” style=”stroked” background=”#51d461" color=”#ffffff” size=”6" center=”yes” radius=”0" icon=”icon: arrow-circle-o-down”]Download Full Source Code[/su_b[/su_button]p> 

But why ?

First of all we need a reason for this change.

  • And the reason is great simplification of the watcher which will provide only the changed text which is needed in most of the cases.
  • Also we can also hook RxJava operators to the stream to manipulate the output.
  • Reduction in code boilerplate code.
  • Also its cool.. \m/

Lets start coding

First of all you have to add support for RxJava in your gradle file as explained in this tutorial. We are using lambda expression in this tutorial for code clarity, so you should setup that also from our tutorial. Also need to add RxBindings to app/build.gradle file

GuRu

Technology enthusiast. Loves to tinker with things. Always trying to create something wonderful using technology. Loves coding for Android, Raspberry pi, Arduino , Opencv and much more.

You may also like...

2 Responses

  1. January 23, 2017

    […] Using RxBinding instead TextWatcher on EditText […]

  2. July 13, 2018

    […] Adding TextWatcher on EditText using Rxjava and RxBinding […]

Leave a Reply

Your email address will not be published. Required fields are marked *