This post is going to save lot of your time from using the FindViewById. So I found this interesting article on Medium.com No more findviewById written by George Mount. and I thought why don't I write how it can be done in sample program . That would be much easier to understand isn't . So here it is. And please read the article first from Medium.com first . In this post I will demonstrate you , how to use dataBinding option in Android Studio, which will will eliminate the painful part of binding every view in xml with your Java. Your Android Studio must be version 1.5 and Higher. 1. Add the Following lines to your app Build.gradle file : android { dataBinding . enabled = true ; } After adding this line to your app gradle file, the file should look something like this. apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "23.0.0" dataBinding.enabled = true; defaultConfig { ...
Android code Samples to help few, who are looking for!