public class ResponseFromRest { @NonNull static Callback getResponseOrFailure() { return new Callback() { @Override public void onResponse(Call call, Response response) { //did } @Override public void onFailure(Call call, Throwable t) { Log.d("IVO", "onFailure: "+t); } };