Created
July 22, 2020 01:50
-
-
Save arkilis/e5dc09fe3da5369fcdb5176c6d0c3ba6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.flyingbits.kotlinlearn | |
import androidx.lifecycle.MutableLiveData | |
import androidx.lifecycle.ViewModel | |
class MyViewModel: ViewModel() { | |
private var num: MutableLiveData<Int> = MutableLiveData(0) | |
public fun getNum(): MutableLiveData<Int> { | |
return this.num | |
} | |
public fun addNum(n: Int) { | |
this.num.value = this.num.value!! + n | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment