Call api using Volley library Demo


Call rest API using Volley in Android

The very basic requirement in developing the Android application is “Api Integration” and fetch the details. For calling the Api we need the android networking library to interact with the web services and get the response from Api.

One such library is Volley which is developed by Google to handle Api calls.

Volley is an HTTP library that makes networking for Android apps easier and most importantly, faster. Volley is available on GitHub.

To know more about Volley, go here.

Our Post is divided into five parts, we will call

Its a collection of apis , for our demo we are fetching the list of popular movies from tmdb and display in recyclerview.

Pre Requisites:

We need to sign up and get the api_key before we can call any Api.


We  need to add below dependencies in app->build.gradle

dependencies {
    //recyclerview to show list
    implementation ''
    implementation ''

    implementation ''


Structure for Volley Api request class is a common class to call APIs. We just have to create an instance of the class and call its appropriate constructor to initialize our Volley api call.

For future enhancement, we have added different parameters if we need to call the APIs with custom headers and parameters.

Top 10 free Android libraries for app development in android studio

Recyclerview to display List

Here we will call TOP_RATED  movie API in the call method mentioned in the to fetch the results.

The most important method is ReqSuccessListener which will handle the callback if API returns the results.

ReqErrorListener method will handle any server error if any in the response. If the server returned unexpected response then this method will handle it.


Calling Tmdb API

Adding the load more or infinite scrollview to recyclerview.

We have attached a scroll listener as always we need to add endless scroll or infinite scroll to load the results. In web format, we call it paging based on the number of results. Say we need 20 results in one API call. And then again next 20 sequentially.

This can be used by you in any application or projects.

For Complete Demo of Volley using Gson find the source codes in below project.

Feeling glad to receive your comment