My first assumption of SQLite in Android was, there is a lot of code to do very little. Once you get started though its quite easy.
I’m going to step through how to set up the database connection initially and insert and delete some data from it.
CLICK HERE FOR COMPLETE PROJECT
Within the complete project I have provided examples of how to use the methods which are created bellow.
SETTING UP DATABASE CLASS
1. Create a database class and make it extend SQLiteOpenHelper
2. Create a variable for the database version, something like this:
private static final int DATABASE_VERSION = 1;
3. Give you database a name:
private static final String DATABASE_NAME = « imAnExample »;
4. Create your tables names. You can have as many as you like. Within this example I am only going to have one table.
private static final String TABLE_VEGETABLES = « vegetables »;
5. Now create your…
View original post 221 mots de plus