Fetching the profile details

To fetch the profile details, we need to create a function named getUser() in which we will call getUserById() from the Profile services. In return, it will provide the user details, or if there is an error, it will show the error message. Here is the code of the getUserById() function:

private fun getUser(){
APIClient.profileAPICall(username,password)
.getUserById(PrefUtils.getUsernameID(this)!!)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
myUser ->

usernamePro.text = myUser.username
profileFullNamePro.text = "${myUser.firstName} ${myUser.lastName}"
emailPro.text = myUser.email
contactNumberPro.text = myUser.contactNumber
countryPro.text = myUser.country
},{
error ->
UtilMethods.hideLoading()
Log.wtf("******", error.message.toString())
})
}

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.31.125