I have some data provided from an API for example this is the data, this is just a part of the data, but this is the part that I need to access
"logo_url_string": null,
"name": "google",
"category_image": {
"id": 24,
"cover_url": {
"url": "http://",
"icon_circle": {
"url": "http://"
}
The question is how can I access the "url" inside cover_url thats inside category_image?, and so far I've been able to access it from a Model class with setter and getters and an adapter but I don't know how can I access data that is nested with setters and getters I have to do it with setters and getters because I have an adapter class where I get all the data into de cardview and then I load it to a recycler that is in a fragment, please any help would be great Thank you! my model is like this
Business.java
public class Business {
private String name, description, email, website, logo_url_string,cover_url_string;
public Business(){}
public class Images{
}
public Business(String name, String logo_url_string) {
this.name = name;
this.logo_url_string = logo_url_string;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getLogo_url_string() {
return logo_url_string;
}
public void setLogo_url_string(String logo_url_string) {
this.logo_url_string = logo_url_string;
}
And I access that data with and Adapter
Adapter.java
public class SearchHorizontalAdapter extends RecyclerView.Adapter<SearchHorizontalAdapter.ViewHolder> {
private ArrayList<Business> premiumsList;
Bitmap bitmap;
ImageView logo;
private Activity activity;
private int layoutMolde;
public SearchHorizontalAdapter(Activity activity, ArrayList<Business> list, int layout ) {
this.activity = activity;
this.premiumsList = list;
layoutMolde = layout;
}
@Override
public SearchHorizontalAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.search_high_layout, parent, false);
return new ViewHolder(view);
}
@Override
public void onBindViewHolder(SearchHorizontalAdapter.ViewHolder holder, int position) {
// holder.mTitle.setText(premiumsList.get(position));
holder.mTitle.setText(premiumsList.get(position).getName());
//holder.mImg.setImageURI(Uri.parse(premiumsList.get(position).getLogo_url_string()));
// if( Glide.with(this.activity).load(premiumsList.get(position).getLogo_url_string())==null) {
// Glide.with(this.activity).load(premiumsList.get(position).getCategory_image()).into(holder.mImg);
// }
Glide.with(this.activity).load(premiumsList.get(position).getLogo_url_string()).into(holder.mImg);
}
@Override
public int getItemCount() {
return premiumsList.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
public TextView mTitle;
public ImageView mImg;
public ViewHolder(View itemView) {
super(itemView);
mTitle = (TextView) itemView.findViewById(R.id.nom_business);
mImg= (ImageView) itemView.findViewById(R.id.img_business);
}
}
}