Take the 2-minute tour ×

I am currently working with the new eclipse ADT (Android Development Tools). When I used an older version, there was a plugin from Motorola named MotoDev Studio which helped you to make a database quite easily. It doesn't seem to work anymore with the new ADT.

Does anyone have a good alternative to making an easy SQLite database with content, and "converting" it to Java code for Android? (I've been looking online, but can't seem to find it)

share|improve this question

2 Answers 2

I just do it by hand. I have this in my Makefile:

# Note: you MUST use the version of sqlite3 provided with Android sdk
SQLITE = ~/Android/android-sdk-linux_86/tools/sqlite3

foo.db: wpt.csv foo.sqlite3
        tail -n +3 wpt.csv > wpt.tmp
        rm -f $@
        ${SQLITE} $@ '.read foo.sqlite3'

And my foo.sqlite3 file looks like:

    sector INT,
    lat FLOAT,
    lon FLOAT,
    type TINYTEXT,
    charts TEXT);
CREATE INDEX wptIdx ON wpt (sector);

.separator ":"
.import wpt.tmp wpt

I realize this isn't what you were looking for, but this avoids having dependencies on specific versions of specific IDEs, which you now know can bite you.

share|improve this answer

You can use this eclipse plugin: https://github.com/sromku/android-sqlite-model-generator-plugin

This plugin allow easily generate java source code for Android based on SQLite database schema which you define in JSON file.

  1. Create JSON file that describes your schema. Example is here

  2. Right click on the JSON file -> Generate SQLite Model...:

enter image description here

Then, you can work with the database by using the generated code. For example, if you define Student table with few columns, then adding new student will look like this:

Student student = new Student();

Model model = Model.getInstance(context);

More info and details could be found in the GitHub project

share|improve this answer

Your Answer


