Home Android DroidModel

Android DroidModel

Android DroidModel

Language :
Platform :
Type :

Go :

Models abstraction for Android.

Project Download Contributors


DroidModel is an android library which provides model abstraction for SQLite database. Trivial database tasks like creating tables, inserting or retriving are part of this library.


  • Create a package called models in the repository
  • Create a class called ModelManager extending DroidModelManager
import android.content.Context;

import com.creativemindz.droidmodel.DroidModelManger;

public class ModelManager extends DroidModelManger {
    public static void init(Context context){
        databaseName = "SampleDatabaseName";
        databaseVersion = 1;
        // TODO: Set sync strategy

        // Initialize models to create all required tables
        User u = new User();

You can provide database names and version here Note: Automatic database version increment is not supported yet.

  • Create models as required extending DroidModel
import com.creativemindz.droidmodels.DroidModel;

public class User extends DroidModel {

    @DroidModel.Key(type = "PrimaryKey")
    public String email;

    @DroidModel.Key(type = "String")
    public String name;

    public User(){


Note: With DroidModel, you don't have to write SQL queries for each table ( Model in this case )

Supported Operations

Create table

User u = new User();

Note: If already created, this won't create table again

Add entries

User u = new User();
u.email = "[email protected]";
u.name = "Praveen Penumaka";

Retrieve one entry

User u = new User();
u.email = "[email protected]";
System.out.println(u.name); // prints - Praveen Penumaka

Update one entry

User u = new User();
u.email = "[email protected]";
u.name = "Penumaka Praveen";

Retrieve all

ArrayList<User> users = User.findAll(User.class);


  • Sync operation with remote URL
  • Add threads and callbacks for handling huge operations
  • SUpport more data structures like Arraylist, HashMap


    Leave a Reply

    Your email address will not be published. Required fields are marked *

    twelve + one =

    Leave a Comment

    4 × one =