Skip to main content

Posts

Showing posts from March, 2016

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