Skip to main content

Posts

No FindViewById

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 {
Recent posts

Sugar ORM SQlite Android Part 2

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= "true"

Sugar ORM With Sqlite Android Part I

Sugar ORM  Android Part I:              If you have came this far in search of how to use an ORM database with your application , you are very much familiar with pain that SQLite querying concept is giving you for all basic CRUD operations with the database. Sugar ORM is  one of the solution which is available for you to carry out CRUD operation in ease, There is no need to use cursor  for reading from database, Sugar ORM speaks Object with Sqlite database. Sugar ORM consider a row of data as Object, where SQLite consider it as record. In this example I am going to show you how to create a table and add data to it using Sugar ORM. Let's get started. 1. Library Inclusion First and Foremost thing, add Sugar ORM to your project by adding the following line to your app dependencies. compile 'com.github.satyan:sugar:1.4' 2. Add Database configuration to Application Manifest: We have to inform the android sdk, that we are using SugarORM to handle CRUD