Check Mobile App
Read now

Android Databinding: taking advantage of custom setters

Save

Data binding is not new anymore. Many apps are currently now using data binding. Even on the web, many frameworks are now using data binding. One such example is use of data binding with Knockout.js

However, the data binding docs is still under development and android data binding is updated parallel to the release of new version of android studio. So we can hope that in upcoming versions of the android studio we will have better support for android data binding.

If you haven’t gone through the android data binding yet, I strongly suggest you to have a look following topics/series:

https://developer.android.com/topic/libraries/data-binding/index.html

https://medium.com/@georgemount007

In this blog, we will see various live example of android data binding setter’s

DIMENSION ARITHMETICS

In the given example, we are adding two dimensions and using it to set the views dimension.

 

 

SETTING FONT

We can also take advantage of data binding to set the custom font of the application.

 

 

CREATING UTILITIES FOR CODE REUSABILITY AND CLEAN CODE

We can also create custom bindings to prevent writing extra code and reusing the same binding utility method at design time. In this example, we are setting HTML text to a text view via data binding.

 

That’s all it take for “lazy” programming 😀 Stay calm and keep coding!

. . .

Leave a Comment

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


Be the first to comment.

css.php

When I think in getting solutions for my Ecommerce Platform, I think of Webkul. They have been such a blessing in our business. We have spent thousands of dollars in support and modules from them. We love their support team. They work very closely with us, and they always go the extra mile when we need help.

Michael Urresta

Michael Urresta

Talk to Sales

Global

Live Chat
Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home