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 { ...
Code Walkthrough : Previously you have seen how to use SugarORM with Android . In this , I will be giving you a walkthrough how the whole code works in an application, with a sample application which I have created. you can also download the complete android studio project from here AndroidManifest.xml: This is how the sample application will look like, when the application get installed, android will create an sqlite database named codexandroid.db as mentioned in this manifest. It will also assign the database version to be 1, if you add more table to your database you have to increement your database version number before deploying it on Google play store or for demo. android:noHistory="true" --> This is to stop android from keeping activity in stack , so that when you press back in this application, you won't be taken back to the previously used activity. <application android:allowBackup...