Created
August 8, 2017 13:03
-
-
Save nikhilbansal97/a266688969aeefe22593b7028bdb75df to your computer and use it in GitHub Desktop.
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
package com.example.nikhil.simpledatabase.database; | |
import android.content.Context; | |
import android.database.sqlite.SQLiteDatabase; | |
import android.database.sqlite.SQLiteOpenHelper; | |
public class DataHelper extends SQLiteOpenHelper { | |
public static final String DATABASE_NAME = "data.db"; | |
public static final int DATABASE_VERSION = 1; | |
public DataHelper(Context context) { | |
super(context, DATABASE_NAME, null, DATABASE_VERSION); | |
} | |
@Override | |
public void onCreate(SQLiteDatabase sqLiteDatabase) { | |
String CREATE_TABLE_QYERY = "CREATE TABLE " + DataContract.DataProvider.TABLE_NAME + "( " + | |
DataContract.DataProvider.COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + | |
DataContract.DataProvider.COLUMN_DATA_ITEM + " TEXT NOT NULL);"; | |
sqLiteDatabase.execSQL(CREATE_TABLE_QYERY); | |
} | |
@Override | |
public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1) { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment