Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 3.0.3.7 release ready!
Deniel Kerr
Founder. Opencart
Top Partners
Based on the post i have written earlier about clean and efficient architecture for developing application using Rx. This will continue with the same theme. If you think what i am talking about have a look at my last blog on reactive programming. link given below.
RxAndroid: From begining to some use cases
Let’s take an example before we start:
For most devs, implementing this kind of reactive callback chaining yourself will prove a time-consuming and error-prone mess. The problem increases when there are certain operation need to be perform like ignore the text when user is typing or when the text has only few characters. Using conventional callbacks may lead to pain in maintaining boilerplate code when the activity is already a God Object (contain every stuff).
Here comes the RxBinding to rescue from such kind of problem.
RxBinding is a set of libraries that allow you to react to user interface events via the RxJava paradigm.
This mean we can have the benefits of Rx (event paradigm) for our views as well.
The real benefit here is the syntactic sugar over the existing Android API’s that make your code more readable and consistent. Regardless if you’re observing a click event, a text change event, or even a dismissal of a Snackbar, RxBinding provides a consistent implementation that you can use to react accordingly.
Being an Observable, we can apply every transformation to the stream of data provided by just using the factory methods provided by the class RxView.
So coming to our problem of preventing unnecessary calls when user is typing to enhance performance by reducing load on server. We can apply variety of observable functions to do that.
Just a debounce function and the problem solved. Behind the scene debounce wait for the applied timeout to hold the stream of input data. If some other event occur during the debounce timeout then the new data replaced the earlier one. And thus no processing is done when user is interacting with the application during debounce time period.
Hope you get the real idea behind it’s usage.
Note: Earlier in Retrofit 1, there was a class called ViewObservable do the same thing like RxTextView(which is present in Retrofit 2)
Your email address will not be published. Required fields are marked*
Name*
Email*
Save my name email and website in this browser for the next time I comment.
Be the first to comment.
We use cookies to personalize your experience. By continuing to visit this website you agree to our use of cookies. Learn more about privacy policy
All communication is done through a ticket system. I appreciate the regular almost daily updates of what is being worked on, and communicating changes or updates is easy through this system. Mobikul's response timeframe is quick.
Josh Arnold
Owner, Shop ATV Escape
USA
India
Global
Name
Email
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.