Helper Class Android SQLiteOpenHelper SQLiteDatabase
import android.database.sqlite.SQLiteOpenHelper import android.database.sqlite.SQLiteDatabase import android.content.ContentValues import android.content.Context import android.database.Cursor class Helper (context: Context?):SQLiteOpenHelper(context,DATABASE_NAME,null,1) { override fun onCreate(db: SQLiteDatabase) { db.execSQL( "CREATE TABLE " + TABLE_NAME + "(" + KEY_ID + " INTEGER PRIMARY KEY, " + KEY_NOM + " TEXT," + KEY_VILLE + " TEXT," + KEY_LAT + " TEXT, " + KEY_LONG + " TEXT )" ) } override fun onUpgrade( db: SQLiteDatabase, oldVersion: Int, newVersion: Int ) { } fun addCentre(centre: Centre) { val db = this.writableDatabase val cv = ContentValues() cv.put(KEY_NOM, centre.getNom()) cv.put(KEY_VILLE, centre.getVille()) cv.put(KEY_LAT, centre.getLatitude()) cv.put(KEY_LONG, centre.getLongitude())