public class HomePresenter { private HomeView view; public HomePresenter(HomeView view) { this.view = view; } void getData(int offset) { Call pokemonDataCall = Utils.getApi().getData(offset, 30); pokemonDataCall.enqueue(new Callback() { @Override public void onResponse(Call call, Response response) { HomeActivity.setIsLoading(true); if (response.isSuccessful() && response.body() != null) { view.setData(response.body().getResults()); } else { view.onErrorLoading(response.message()); } } @Override public void onFailure(Call call, Throwable t) { HomeActivity.setIsLoading(true); view.onErrorLoading(t.getLocalizedMessage()); } }); } }