Advance DataBinding in Android

In earlier posts we have already seen

  1. Working with DataBinding Android
  2. Image Loading with DataBinding in Android
  3. Two-way DataBinding in Android
  4. Setting custom font through XML with DataBinding

Today we will discuss more about Advance DataBinding

Binding Events : 

Events will be bound to handler methods directly, like we used to do it with android:onClick. Only change will be we have to take reference of our interface(handler).
Continue Reading


Live Templates in Android Studio

Live Templates

Live templates helps you to write more code with less efforts. Live templates contain predefined code structure. What if you will get whole for loop with just one word? Seems interesting, let’s see how live template can help to increase your productivity.

Live templates are code snippet which can be inserted in your code with their abbreviation and pressing tab. You can find all pre-defined live templates in Editor section of your Android Studio. Continue Reading



Image Loading With DataBinding in Android

Image Loading With DataBinding

We have already seen DataBinding Basics and setting fonts through DataBinding in previous tutorials. Today we will take a look at Image loading with databinding .

Step 1 : Define POJO/Model class

Continue Reading


Setting custom font through XML with DataBinding

Today we will learn about setting custom font through XML with DataBinding. We already know how to set custom font through java code.

It will set font type for given TextView or other View. But what if we have more number of TextViews/EditTexts throughout the application and that also with multiple custom fonts? We need to declare those number of objects for TextView/EditText as well as for TypeFace declaration. Don’t you think it will increase number of codes? Yes, so other option will come in your mind is to create Custom TextView/EditText. Not a bad idea but we have 15-20 custom fonts throughout the app so creating those number of Custom class would realy be a bad idea. So what is the simplest and easy solution? Answer is DataBinding.
Continue Reading