Created
August 15, 2017 01:37
-
-
Save moizest89/d30fb70c5a0f6238c1cd25720af12c07 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DataManager { | |
public void getArticles(final DataManagerCallBacks dataManagerCallBacks){ | |
Call<UserResponse> call = this.apiService.getArticlesList(); | |
call.enqueue(new Callback<UserResponse>() { | |
@Override | |
public void onResponse(Call<UserResponse> call, Response<UserResponse> response) { | |
if(response.isSuccessful()){ | |
UserResponse userResponse = response.body(); | |
dataManagerCallBacks.onSuccess(userResponse); | |
}else{ | |
} | |
} | |
@Override | |
public void onFailure(Call<UserResponse> call, Throwable t) { | |
dataManagerCallBacks.onError(t); | |
} | |
}); | |
} | |
public interface DataManagerCallBacks<T>{ | |
void onSuccess( T onSucces); | |
void onError(Throwable onError); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment