Back to project page KeepMySecret.
The source code is released under:
GNU General Public License
If you think the Android project KeepMySecret listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package keepmysecretapp.app.com.keepmysecretapp.db; //ww w .j a v a 2s. c om import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import keepmysecretapp.app.com.keepmysecretapp.tables.AuthTable; import keepmysecretapp.app.com.keepmysecretapp.tables.DataTable; import keepmysecretapp.app.com.keepmysecretapp.tables.GroupTable; import keepmysecretapp.app.com.keepmysecretapp.tables.QueryTable; public class DbContext extends SQLiteOpenHelper { private static final String DATABASE_NAME = "secret_storage1"; private static final int DATABASE_VERSION = 2; public static DbContext instance = null; private DbContext(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } public static DbContext getInstance(Context context) { if (instance == null) instance = new DbContext(context); return instance; } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { QueryTable table = new AuthTable(); db.execSQL(table.getUpgradeQuery()); db.execSQL(table.getCreationQuery()); table = new DataTable(); db.execSQL(table.getUpgradeQuery()); db.execSQL(table.getCreationQuery()); table = new GroupTable(); db.execSQL(table.getUpgradeQuery()); db.execSQL(table.getCreationQuery()); } @Override public void onCreate(SQLiteDatabase db) { QueryTable table = new AuthTable(); db.execSQL(table.getCreationQuery()); table = new DataTable(); db.execSQL(table.getCreationQuery()); table = new GroupTable(); db.execSQL(table.getCreationQuery()); } }