2023-10-18 13:44:15 +04:00

19 lines
534 B
Kotlin

package com.example.android_programming
import android.app.Application
import com.example.android_programming.database.AppDatabase
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
class App : Application() {
val database by lazy { AppDatabase.getInstance(this)}
override fun onCreate() {
super.onCreate()
// this.deleteDatabase("my-db")
CoroutineScope(Dispatchers.IO).launch {
AppDatabase.populateDatabase()
}
}
}