Last active
September 15, 2018 00:22
-
-
Save barmgeat/e3c00576bc633826acf8b093e99e4170 to your computer and use it in GitHub Desktop.
SQLite Helper Class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HelperClass extends SQLiteOpenHelper { | |
//Name of the database | |
private static final String DATABASE_NAME = "DBName.db"; | |
//DB Version | |
private static final int DATABASE_VERSION = 1; | |
public HelperClass(Context context) { | |
super(context, DATABASE_NAME, null, DATABASE_VERSION); | |
} | |
/** | |
* onCreate when the database create for first time . | |
*/ | |
@Override | |
public void onCreate(SQLiteDatabase db) { | |
// Statement to create the table | |
String CREATE_WORDS_TABLE = "CREATE TABLE " + WordsEntry.TABLE_NAME + " (" | |
+ WordsEntry._ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " | |
+ WordsEntry.COLUMN_WORD + " TEXT NOT NULL, " | |
+ WordsEntry.COLUMN_WORD_T + " TEXT, " | |
+ WordsEntry.COLUMN_WORD_T2 + " TEXT, " | |
+ WordsEntry.COLUMN_WORD_T3 + " TEXT, " | |
+ WordsEntry.COLUMN_ARTIKEL + " INTEGER );"; | |
// exceute the Statement | |
db.execSQL(CREATE_WORDS_TABLE); | |
} | |
@Override | |
public void onUpgrade(SQLiteDatabase db, int i, int e) { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment