androidjsonandroid-jsonandroid-parserandroid-xmlpullparser

Why we use Callback response in enqueue method of OKhttp in android


I just made a simple JSON parsing program with Okhttp now what is Callback in Response of OKhttp and Why we use this ?

OkHttpClient okHttpClient=new OkHttpClient();

    Request request=new Request.Builder().url(url).build();

  okHttpClient.newCall(request).enqueue(new Callback() {
        @Override
        public void onFailure(Call call, IOException e) {

        }

        @Override
        public void onResponse(Call call, Response response) throws IOException {

        }
    });

Solution