Skip to content

Instantly share code, notes, and snippets.

@NitinPraksash9911
Created January 12, 2021 16:25
Show Gist options
  • Save NitinPraksash9911/84af2b861bc2d0616a2543390d131f2b to your computer and use it in GitHub Desktop.
Save NitinPraksash9911/84af2b861bc2d0616a2543390d131f2b to your computer and use it in GitHub Desktop.
class TestViewModel(application: Application) : AndroidViewModel(application) {
private var dataLiveData = MutableLiveData<Int>()
var data = dataLiveData as LiveData<Int>
private val roomDb = RoomDb.getInstance(application).getUserDao()
fun insertUser(user: User) {
roomDb.insertUser(user)
}
fun deleteUser() {
roomDb.deleteUser()
}
..
..
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment