Sunday, August 1, 2010

Generate Android Application From XML Definition

Two weeks ago i was searching for some tool which will boost my development on great Android platform. Because in every application there are some methods, classes, that are repeatable i thought that maybe there are some utilities that will generate that classes for me on which every developer spend some time to write them from scratch. After long time for searching i found only SQLiteGen tool which generate data access class for written simple interface and nothing more which is only one part from developed application. SQLiteGen is great tool but there are things that are still missing and should be programmed again and again for every application.
For completely crud application we need entity classes, db helper class or content provider, dao classes and basic generated activities for manipulating the data. For that reason i came with idea to implement simple crud code generator which will generate crud application based on simple xml definition on entity classes, and then Android CRUD Code Generator is born.

Android CRUD Code Generator contains 5 different generators, Activity Generator, Dao Generator, DBHelper Generator, Entity Generator and Service Generator.

DBHelper Generator generate dbhelper class that is used for creating application database. Generated DBHelper class is singleton class for better reusing on database connection.
Entity Generator generate entity classes with getters and setters for every database table defined in xml definition file.
Dao Generator generate basic crud operations for every entity class in classical DAO way, separated implementations from interfaces. Every DAO implementation is also singleton class.
For now those 3 generators are implemented and implementation on Activity Generator is in process.
In second phase there are plans for implementing simple DSL that will be written in XML definition file and from which specific code will be generated by Service Generator.

In the next post i'll show how to develop simple crud application from xml entity description, i hope by then i'll finish Activity Generator :)


  1. where can I access the generator?

  2. ACG is hosted at Google Code, please check the following url to the project.

  3. This one of the well organised and developed post.I like your blog clarity.This is one of the user friendly post.
    Android app developers