Copyright (c) 2013, Uthcode
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redi...
If you think the Android project android_tutorial_projects listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package com.uthcode.todos.database;
//www.java2s.comimport android.database.sqlite.SQLiteDatabase;
import android.util.Log;
/**
* Created by skumaran on 12/29/13.
*/publicclass TodoTable {
publicstaticfinal String TABLE_TODO = "todo";
publicstaticfinal String COLUMN_ID = "_id";
publicstaticfinal String COLUMN_CATEGORY = "category";
publicstaticfinal String COLUMN_SUMMARY = "summary";
publicstaticfinal String COLUMN_DESCRIPTION = "description";
privatestaticfinal String DATABASE_CREATE = "create table "
+ TABLE_TODO
+ " ( "
+ COLUMN_ID + " integer primary key autoincrement, "
+ COLUMN_CATEGORY + " text not null, "
+ COLUMN_SUMMARY + " text not null,"
+ COLUMN_DESCRIPTION
+ " text not null"
+ ");";
publicstaticvoid onCreate(SQLiteDatabase database) {
database.execSQL(DATABASE_CREATE);
}
publicstaticvoid onUpgrade(SQLiteDatabase database, int OldVersion, int newVersion) {
Log.w(TodoTable.class.getName(), "Upgrade from " + OldVersion + " to " + newVersion + " will destroy data");
database.execSQL("DROP TABLE IF EXISTS " + TABLE_TODO);
onCreate(database);
}
}