January 2019
Intermediate to advanced
392 pages
10h 11m
English
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 -> ...Read now
Unlock full access