Created
October 3, 2018 09:52
-
-
Save pedromassango/06ac5ddbce88f453f7845609509e5701 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
| //... Code removed for brevity | |
| class MainViewModel(private val repository: Repository) : ViewModel() { | |
| private var messageData: MutableLiveData<String>? = null | |
| fun loadData(): LiveData<String>?{ | |
| if(messageData == null){ | |
| messageData = MutableLiveData() | |
| } | |
| // Getting message from repository class | |
| messageData!!.postValue( repository.getMessage()) | |
| return messageData | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment