Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- val userIdLiveData:MutableLiveData = ...;
- val userLiveData:LiveData = Transformations.switchMap(userIdLiveData, id ->
- repository.getUserById(id)); // LiveData를 리턴합니다.
- fun setUserId(userId:String) {
- this.userIdLiveData.setValue(userId);
- }
Add Comment
Please, Sign In to add comment