If you think the Android project SecNote 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.baraccasoftware.securenotes.object;
/*fromwww.java2s.com*/import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
publicclass SecureDatabaseHelper extends SQLiteOpenHelper {
privatestaticfinal String DB_NAME = "notes.db";
privatestaticfinalint DB_VERSION = 1;
//notes table
publicstaticfinal String NOTES_TABLE_NAME = "notes";
publicstaticfinal String ID_NOTE = "id";
publicstaticfinal String TITLE_NOTE = "title";
publicstaticfinal String TEXT_NOTE = "note_text";
publicstaticfinal String DATA_NOTE = "note_date";
publicstaticfinal String IMG_NOTE = "image";
//create note table
privatestaticfinal String TABLE_NOTE_CREATE= "create table " +
NOTES_TABLE_NAME+" ("+ID_NOTE + " integer primary key , " +
TITLE_NOTE+" text not null, "+ TEXT_NOTE + " text not null, " +
DATA_NOTE+" text not null, "+ IMG_NOTE + " blob );";
public SecureDatabaseHelper(Context context) {
super(context, DB_NAME, null, DB_VERSION);
}
@Override
publicvoid onCreate(SQLiteDatabase database) {
Log.d("TableCreations",TABLE_NOTE_CREATE);
database.execSQL(TABLE_NOTE_CREATE);
}
@Override
publicvoid onUpgrade(SQLiteDatabase database, int old_version, int new_version) {
Log.w(SecureDatabaseHelper.class.getName(),
"Upgrading database from version " + old_version + " to "
+ new_version + ", which will destroy all old data");
database.execSQL("DROP TABLE IF EXISTS " + NOTES_TABLE_NAME);
onCreate(database);
}
}