mrRobot :
I have a function loadProfile()
private void loadProfile() {
mSubscriptions.add(RetrofitClient.getRetrofit(mToken).getProfile(mEmail)
.observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io())
.subscribe(this::handleResponse,this::handleError));
}
which calls handleResponse
private void handleResponse(Response response, User user) {
//some code
}
And handleResponse
is defined in my Api
class like this:
@GET("Users/{id}")
Observable<retrofit2.Response<User>> getProfile(@Path("id") String id);
And I am getting cannot resolve method handleResponse
in loadProfile()
I checked parameter types as many similar questions suggest, but can't find the problem. I hope I provided everything necessary to find the problem.
Sergey S :
Since your return type is Observable<Response<User>>
I think your method should be
private void handleResponse(Response<User> response) {
if (response.isSuccessful()) {
User user = response.body()
} else {
// some code
}
}