January 2018
Intermediate to advanced
434 pages
14h 1m
English
Follow these steps to convert the cursor into a list of objects:
data class Customer(val id: Int, val name: String, val phone_num: String) { companion object { val COLUMN_ID = "id" val TABLE_NAME = "customers" val COLUMN_NAME = "name" val COLUMN_PHONE_NUM = "phone_num" }}
class DatabaseHelper(ctx: Context) : ManagedSQLiteOpenHelper(ctx, "SupportDatabase", null, 1) { companion object { private var instance: DatabaseHelper? = null @Synchronized fun getInstance(context: Context): DatabaseHelper { if (instance == null) { instance = DatabaseHelper(context. ...
Read now
Unlock full access