Category : type-mismatch

I am developing a new android where I am getting images by using retrofit in android but I am getting the following errors below following my json structure json structure below my DogResponse data class data class DogResponse( @SerializedName("message") val message: List<String>, @SerializedName("status") val status: String ) below my network logic interface DogInterface { @GET("breed/hound/images") ..

Read more

how to pass Parcelable object in a function in Kotlin private val _rvIssueMaterialResult: MutableLiveData<Resource<RvIssueMaterialResponse>> = MutableLiveData() val rvIssueMaterialResult: LiveData<Resource<RvIssueMaterialResponse>> get() = _rvIssueMaterialResult fun callRvIssueMaterialApi(stockId: String) = viewModelScope.launch { //_updateDimensionsResult.value = Resource.Loading _rvIssueMaterialResult.value = repository.callRvIssueMaterialApi(stockId) } In last line getting following error Type mismatch. Required: Resource<RvIssueMaterialResponse>? Found: Resource<RvIssueMaterialResponse?> Trying pass RvIssueMaterialResponse but its not mandatory Here ..

Read more

I have the following in my viewmodel : // hold the list of comments of a Post private val _commentsOfPost = MutableLiveData<PagedList<Comment>>() val commentsOfPost : LiveData<PagedList<Comment>> = _commentsOfPost fun getCommentsOfPost(postId: Long){ _commentsOfPost.value = commentRepository.getCommentsOfPost(postId) // <— TYPE MISMATCH } So, what happens is that whenever the getCommentsOfPost() is called by the Fragment, it retrieves a ..

Read more