In this article, we will show how we can populate the recycler view using data fetched using the Retrofit library.
Retrofit is one of the famous HTTP libraries used to parse the data from remote databases using APIs. This library can be used to fetch the data from API in the form of JSON and display the API data within our application. Retrofit is a powerful tool for consuming RESTful web services in Android. It is easy to use and makes it easy to create type-safe HTTP clients.
Below are the dependencies that you need to add to your build.gradle project level.
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.jakewharton.retrofit:retrofit1-okhttp3-client:1.1.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'androidx.recyclerview:recyclerview:1.2.0'
implementation "androidx.cardview:cardview:1.0.0"
Note: please make sure that you add the latest version of dependencies.
Below are the permissions that you need to add to your AndroidManifest.Xml file
<uses-permission android:name="android.permission.INTERNET" />
Now we need to sample the JSON data below is an example of JSON data that I am going to use in this tutorial.
{"data": [
{
"id": 1,
"email": "[email protected]",
"first_name": "George",
"last_name": "Bluth",
"avatar": "image url"
},
{
"id": 2,
"email": "[email protected]",
"first_name": "Janet",
"last_name": "Weaver",
"avatar": "image url"
},
{
"id": 3,
"email": "[email protected]",
"first_name": "Emma",
"last_name": "Wong",
"avatar": "Image url"
},
{
"id": 4,
"email": "[email protected]",
"first_name": "Eve",
"last_name": "Holt",
"avatar": "Image url"
},
{
"id": 5,
"email": "[email protected]",
"first_name": "Charles",
"last_name": "Morris",
"avatar": "Image url"
},
{
"id": 6,
"email": "[email protected]",
"first_name": "Tracey",
"last_name": "Ramos",
"avatar": "Image url"
}
],
}
Now we need to convert this JSON data into a format that is readable by our Java compiler for that we create model classes.Model class is a custom class responsible for holding the information for every Item of the RecyclerView. You can simply copy the json data and paste it into https://json2csharp.com/code-converters/json-to-pojo here and it will get the work done for you. Below is the model class I am using in this tutorial.
import java.util.ArrayList;
public class RecyclerModel {
public ArrayList<Datum> getData() {
return data;
}
public int total_pages;
public ArrayList<Datum> data;
public class Datum{
public int id;
public String email;
public int getId() {
return id;
}
public String getEmail() {
return email;
}
public String getFirst_name() {
return first_name;
}
public String getLast_name() {
return last_name;
}
public String getAvatar() {
return avatar;
}
public String first_name;
public String last_name;
public String avatar;
}
}
We need to create an instance using Retrofit. Builder class and configure it with a base URL to issue network requests to a rest API with Retrofit. The addConverterFactory() method tells Retrofit how to convert the response body into a POJO (plain old Java object).
import java.io.IOException;
import java.net.CookieManager;
import java.net.CookiePolicy;
import java.util.concurrent.TimeUnit;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class Api {
Retrofit retrofit = null;
private static final int connectTimeOut = 2, readTimeOut = 3, writeTimeOut = 120;
public Retrofit getClient(final String token_) {
CookieManager cookieManager = new CookieManager();
cookieManager.setCookiePolicy(CookiePolicy.ACCEPT_ALL);
OkHttpClient client = new OkHttpClient.Builder().
connectTimeout(connectTimeOut, TimeUnit.MINUTES)
//.cookieJar(new JavaNetCookieJar(cookieManager))
.readTimeout(readTimeOut,TimeUnit.MINUTES).addInterceptor(new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Request original = chain.request();
String token = "Bearer "+ token_;
String userAgent = System.getProperty("http.agent");
Request request = null;
if (token != null) {
request = original.newBuilder()
.header("User-Agent",userAgent)
.header("Content-Type","text/html")
.header("Accept", "application/json")
.header("X-Requested-With", "ANDROID")
.method(original.method(), original.body())
.build();
return chain.proceed(request);
}
return chain.proceed(original);
}
})
.writeTimeout(writeTimeOut, TimeUnit.SECONDS)
.build();
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
Retrofit.Builder builder = new Retrofit.Builder()
.baseUrl("BASE URL")
.addConverterFactory(GsonConverterFactory.create())
.client(client);
retrofit=builder.build();
return retrofit;
}
Now let us create a Retrofit interface to define the API endpoints that you will be using. For example, you could create an interface with a method to fetch a list of users:
import com.example.retrofitexample.RecyclerModel;
import com.example.retrofitexample.RetrofitModel;
import retrofit2.Call;
import retrofit2.http.GET;
public interface ApiInterface2 {
@GET("users")
Call<RecyclerModel> viewUsers1();
}
The @GET annotation tells Retrofit to use the HTTP GET method to make the request. The users path tells Retrofit to make the request to the users endpoint. The Call object represents the asynchronous request.
We will be creating the single item of list created by the recycler view.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp">
<ImageView
android:id="@+id/image_view"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginTop="10dp"
android:src="@drawable/splash_circle" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@id/image_view">
<TextView
android:id="@+id/first_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="First name"
android:textColor="@color/black"
android:textSize="16dp" />
<TextView
android:id="@+id/last_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/first_name"
android:layout_marginTop="10dp"
android:text="last name"
android:textColor="@color/black"
android:textSize="16dp" />
<TextView
android:id="@+id/email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/last_name"
android:layout_marginTop="10dp"
android:text="email"
android:textColor="@color/black"
android:textSize="16dp" />
</RelativeLayout>
</RelativeLayout>
Now we will first create the adapter class for our recycler view.This is an abstract class that you need to extend to create your own adapter. The adapter is responsible for creating the views, updating the views with new data, and recycling the views that are no longer visible.
Below is my adapter class
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
public class RecyclerAdapter extends RecyclerView.Adapter<RecyclerAdapter.MyViewHolder> {
private Context context;
private ArrayList<SingleRow> singleRowArrayList;
public RecyclerAdapter(Context context, ArrayList<SingleRow> singleRowArrayList) {
this.context = context;
this.singleRowArrayList = singleRowArrayList;
}
@NonNull
@Override
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.model, parent, false);
MyViewHolder viewHolder = new MyViewHolder(view);
return viewHolder;
}
@Override
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
SingleRow singleRow = singleRowArrayList.get(position);
holder.txtTitle.setText(singleRow.getTitle());
holder.txtDesc.setText(singleRow.getDesc());
holder.img.setImageResource(R.drawable.splash_circle);
}
@Override
public int getItemCount() {
return singleRowArrayList.size();
}
class MyViewHolder extends RecyclerView.ViewHolder{
private TextView txtTitle,txtDesc;
private ImageView img;
public MyViewHolder(@NonNull View itemView) {
super(itemView);
txtTitle = (TextView) itemView.findViewById(R.id.txtTitle);
txtDesc = (TextView) itemView.findViewById(R.id.txtDesc);
img= (ImageView) itemView.findViewById(R.id.img);
}
}
}
Below is the main.xml file with recycler view and progress bar.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity3"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/rv"
android:layout_marginTop="5dp"/>
<ProgressBar
android:id="@+id/serach_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_gravity="center_horizontal|center_vertical"
android:visibility="visible" />
</LinearLayout>
Inside the onCreate() method of the MainActivity3.java, I initialize an instance of the ApiInterface2 interface , the Recyclerview, and also the progressbar. Finally, we call the fetchUser() method.
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.Toast;
import com.example.retrofitexample.retrofit.Api;
import com.example.retrofitexample.retrofit.ApiInterface2;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class MainActivity3 extends AppCompatActivity {
RecyclerView rv;
ProgressBar serach_progress;
Call<RecyclerModel> call;
GridLayoutManager gridLayoutManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main4);
rv = findViewById(R.id.rv);
serach_progress = findViewById(R.id.serach_progress);
fetchUsers();
}
private void fetchUsers() {
serach_progress.setVisibility(View.VISIBLE);
rv.setVisibility(View.GONE);
ApiInterface2 apiInterface;
apiInterface = (new Api().getClient("").create(ApiInterface2.class));
call = apiInterface.viewUsers1();
call.enqueue(new Callback<RecyclerModel>() {
@Override
public void onResponse(Call<RecyclerModel> call, Response<RecyclerModel> response) {
serach_progress.setVisibility(View.GONE);
RecyclerModel root = response.body();
if (response.code() == 200) {
rv.setVisibility(View.VISIBLE);
gridLayoutManager = new GridLayoutManager(MainActivity3.this, 1);
rv.setLayoutManager(gridLayoutManager);
DividerItemDecoration itemDecoration = new DividerItemDecoration(MainActivity3.this, GridLayoutManager.VERTICAL);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
itemDecoration.setDrawable(new ColorDrawable(getApplication().getColor(R.color.teal_200)));
}
rv.addItemDecoration(itemDecoration);
RecyclerViewAdapter adapter = new RecyclerViewAdapter(MainActivity3.this, root.getData());
rv.setAdapter(adapter);
} else if (response.code() != 200) {
Toast.makeText(MainActivity3.this, "Something went wrong, Please try again later", Toast.LENGTH_LONG).show();
}
}
@Override
public void onFailure(Call<RecyclerModel> call, Throwable t) {
// Log error here since request failed
serach_progress.setVisibility(View.GONE);
call.cancel();
}
});
}
}
Note: An important aspect is Retrofit handles the requests on the background thread to prevent the UI thread from getting blocked or interfered with.
Fire up the app
Finally, you can run the app and see the output.

Below is the step-by-step implementation of the code
Create a new project and open Gradle Scripts > build.gradle add the dependencies here.
plugins {
id 'com.android.application'
}
android {
compileSdk 33
defaultConfig {
applicationId "com.example.retrofitexample"
minSdk 21
targetSdk 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dataBinding {
enabled = true
}
}
dependencies {
//implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.jakewharton.retrofit:retrofit1-okhttp3-client:1.1.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'androidx.recyclerview:recyclerview:1.2.0'
implementation "androidx.cardview:cardview:1.0.0"
}
Now open your manifests>Android.Manifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.retrofitexample">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="false"
android:icon="@drawable/splash_circle"
android:label="@string/app_name"
android:roundIcon="@drawable/splash_circle"
android:supportsRtl="true"
android:theme="@style/Theme.RetrofitExample"
android:usesCleartextTraffic="true">
<activity
android:name=".MainActivity3"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Now Open Open res -> layout -> activity_main.xml and add the following code
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity3"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/rv"
android:layout_marginTop="5dp"/>
<ProgressBar
android:id="@+id/serach_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_gravity="center_horizontal|center_vertical"
android:visibility="visible" />
</LinearLayout>
Now create a model class in which we have getter methods
import java.util.ArrayList;
public class RecyclerModel {
public ArrayList<Datum> getData() {
return data;
}
public int total_pages;
public ArrayList<Datum> data;
public class Datum{
public int id;
public String email;
public int getId() {
return id;
}
public String getEmail() {
return email;
}
public String getFirst_name() {
return first_name;
}
public String getLast_name() {
return last_name;
}
public String getAvatar() {
return avatar;
}
public String first_name;
public String last_name;
public String avatar;
}
}
Create an Interface name it ApiInterface2.java and paste the following code in it.
import com.example.retrofitexample.RecyclerModel;
import com.example.retrofitexample.RetrofitModel;
import retrofit2.Call;
import retrofit2.http.GET;
public interface ApiInterface2 {
@GET("users")
Call<RecyclerModel> viewUsers1();
}
Create a new Class Api.java and paste the following code into it.
import java.io.IOException;
import java.net.CookieManager;
import java.net.CookiePolicy;
import java.util.concurrent.TimeUnit;
import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class Api {
Retrofit retrofit = null;
private static final int connectTimeOut = 2, readTimeOut = 3, writeTimeOut = 120;
public Retrofit getClient(final String token_) {
CookieManager cookieManager = new CookieManager();
cookieManager.setCookiePolicy(CookiePolicy.ACCEPT_ALL);
OkHttpClient client = new OkHttpClient.Builder().
connectTimeout(connectTimeOut, TimeUnit.MINUTES)
//.cookieJar(new JavaNetCookieJar(cookieManager))
.readTimeout(readTimeOut,TimeUnit.MINUTES).addInterceptor(new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Request original = chain.request();
String token = "Bearer "+ token_;
String userAgent = System.getProperty("http.agent");
Request request = null;
if (token != null) {
request = original.newBuilder()
.header("User-Agent",userAgent)
.header("Content-Type","text/html")
.header("Accept", "application/json")
.header("X-Requested-With", "ANDROID")
.method(original.method(), original.body())
.build();
return chain.proceed(request);
}
return chain.proceed(original);
}
})
.writeTimeout(writeTimeOut, TimeUnit.SECONDS)
.build();
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
Retrofit.Builder builder = new Retrofit.Builder()
.baseUrl("https://reqres.in/api/")
.addConverterFactory(GsonConverterFactory.create())
.client(client);
retrofit=builder.build();
return retrofit;
}
}
Now create a single row xml class for an adapter with name model.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp">
<ImageView
android:id="@+id/image_view"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginTop="10dp"
android:src="@drawable/splash_circle" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@id/image_view">
<TextView
android:id="@+id/first_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="First name"
android:textColor="@color/black"
android:textSize="16dp" />
<TextView
android:id="@+id/last_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/first_name"
android:layout_marginTop="10dp"
android:text="last name"
android:textColor="@color/black"
android:textSize="16dp" />
<TextView
android:id="@+id/email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/last_name"
android:layout_marginTop="10dp"
android:text="email"
android:textColor="@color/black"
android:textSize="16dp" />
</RelativeLayout>
</RelativeLayout>
Now create a adapter class with name RecyclerViewAdapter.java
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.squareup.picasso.Picasso;
import java.util.ArrayList;
public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.MyViewHolder> {
MainActivity3 mainActivity3;
ArrayList<RecyclerModel.Datum> data;
public RecyclerViewAdapter(MainActivity3 mainActivity3, ArrayList<RecyclerModel.Datum> data) {
this.mainActivity3 = mainActivity3;
this.data = data;
}
@NonNull
@Override
public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext())
.inflate(R.layout.recycler_model, parent, false);
MyViewHolder myViewHolder = new MyViewHolder(view);
return myViewHolder;
}
@Override
public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
Picasso.with(mainActivity3)
.load(data.get(position).avatar)
// .resize(Integer.parseInt(context.getResources().getString(R.string.targetProductImageWidth1)),Integer.parseInt(context.getResources().getString(R.string.targetProductImageHeight)))
.placeholder(R.drawable.splash_circle)
.into(holder.image_view);
holder.first_name.setText("First name : "+ data.get(position).getFirst_name());
holder.last_name.setText("Last name : "+ data.get(position).getLast_name());
holder.email.setText("Email ID : "+ data.get(position).getEmail());
}
@Override
public int getItemCount() {
return data.size();
}
class MyViewHolder extends RecyclerView.ViewHolder {
ImageView image_view;
TextView first_name, last_name, email;
public MyViewHolder(@NonNull View itemView) {
super(itemView);
image_view = itemView.findViewById(R.id.image_view);
first_name = itemView.findViewById(R.id.first_name);
last_name = itemView.findViewById(R.id.last_name);
email = itemView.findViewById(R.id.email);
}
}
}
Finally open app -> java -> package -> MainActivity3.java and add the below code.
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.Toast;
import com.example.retrofitexample.retrofit.Api;
import com.example.retrofitexample.retrofit.ApiInterface2;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class MainActivity3 extends AppCompatActivity {
RecyclerView rv;
ProgressBar serach_progress;
Call<RecyclerModel> call;
GridLayoutManager gridLayoutManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main4);
rv = findViewById(R.id.rv);
serach_progress = findViewById(R.id.serach_progress);
fetchUsers();
}
private void fetchUsers() {
serach_progress.setVisibility(View.VISIBLE);
rv.setVisibility(View.GONE);
ApiInterface2 apiInterface;
apiInterface = (new Api().getClient("").create(ApiInterface2.class));
call = apiInterface.viewUsers1();
call.enqueue(new Callback<RecyclerModel>() {
@Override
public void onResponse(Call<RecyclerModel> call, Response<RecyclerModel> response) {
serach_progress.setVisibility(View.GONE);
RecyclerModel root = response.body();
if (response.code() == 200) {
rv.setVisibility(View.VISIBLE);
gridLayoutManager = new GridLayoutManager(MainActivity3.this, 1);
rv.setLayoutManager(gridLayoutManager);
DividerItemDecoration itemDecoration = new DividerItemDecoration(MainActivity3.this, GridLayoutManager.VERTICAL);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
itemDecoration.setDrawable(new ColorDrawable(getApplication().getColor(R.color.teal_200)));
}
rv.addItemDecoration(itemDecoration);
RecyclerViewAdapter adapter = new RecyclerViewAdapter(MainActivity3.this, root.getData());
rv.setAdapter(adapter);
} else if (response.code() != 200) {
Toast.makeText(MainActivity3.this, "Something went wrong, Please try again later", Toast.LENGTH_LONG).show();
}
}
@Override
public void onFailure(Call<RecyclerModel> call, Throwable t) {
// Log error here since request failed
serach_progress.setVisibility(View.GONE);
call.cancel();
}
});
}
}
Leave a Reply