Skip to content

Instantly share code, notes, and snippets.

@nesk
Created June 25, 2018 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nesk/c64cf7c86614d66ca51400b3c62e8c90 to your computer and use it in GitHub Desktop.
Save nesk/c64cf7c86614d66ca51400b3c62e8c90 to your computer and use it in GitHub Desktop.
Android pre-populated database (basic database helper)
package com.example.example
import android.content.Context
import android.database.sqlite.SQLiteDatabase
import android.database.sqlite.SQLiteOpenHelper
class ActsDbHelper(val context: Context) : SQLiteOpenHelper(context, DATABASE_NAME, null, DATABASE_VERSION) {
override fun onCreate(db: SQLiteDatabase?) {
// Nothing to do
}
override fun onUpgrade(db: SQLiteDatabase?, oldVersion: Int, newVersion: Int) {
// Nothing to do
}
companion object {
const val DATABASE_NAME = "mydb"
const val DATABASE_VERSION = 1
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment