1

I'm having JSON format as below, I'm able to fetch this JSON data into android using retrofit but after fetching I'm not getting how to display it in Horizontal RecyclerView in Vertical RecyclerView as shown in below image, I want AAAAA to be displayed instead of Section1 and name1 instead of item1 and respective image to be displayed. Please help me to write android code for this.

enter image description here

  {"result":
           {"AAAAA":[{"firm_name":"name1","image_path":"1.jpg"},
                     {"firm_name":"name2","image_path":"2.jpg"}],
           "BBBBB":[{"firm_name":"name1","image_path":"1.jpg"}],
           "CCCCC":[{"firm_name":"name1","image_path":"1.jpg"}],
           "DDDDD":[{"firm_name":"name1","image_path":"1.jpg"}],
           "EEEEE":[{"firm_name":"name1","image_path":"1.jpg"}]
           }
     }
 This is my Json code

Here is my pojo class

   package com.example;

   import com.google.gson.annotations.Expose;
   import com.google.gson.annotations.SerializedName;

   public class Example {

   @SerializedName("result")
   @Expose
   private Result result;

   public Result getResult() {
   return result;
   }

   public void setResult(Result result) {
   this.result = result;
   }
   }

package com.example;

import java.util.List;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;

public class Result {

@SerializedName("AAAAA")
@Expose
private List<AAAAA> aAAAA = null;
@SerializedName("BBBBB")
@Expose
private List<BBBBB> bBBBB = null;
@SerializedName("CCCCC")
@Expose
private List<Object> cCCCC = null;
@SerializedName("DDDDD")
@Expose
private List<Object> dDDDD = null;
@SerializedName("EEEEE")
@Expose
private List<Object> eEEEE = null;

public List<AAAAA> getAAAAA() {
return aAAAA;
}

public void setAAAAA(List<AAAAA> aAAAA) {
this.aAAAA = aAAAA;
}

public List<BBBBB> getBBBBB() {
return bBBBB;
}

public void setBBBBB(List<BBBBB> bBBBB) {
this.bBBBB = bBBBB;
}

public List<Object> getCCCCC() {
return cCCCC;
}

public void setCCCCC(List<Object> cCCCC) {
this.cCCCC = cCCCC;
}

public List<Object> getDDDDD() {
return dDDDD;
}

public void setDDDDD(List<Object> dDDDD) {
this.dDDDD = dDDDD;
}

public List<Object> getEEEEE() {
return eEEEE;
}

public void setEEEEE(List<Object> eEEEE) {
this.eEEEE = eEEEE;
}
}
madhu
  • 35
  • 1
  • 9
  • 1
    Go through this https://stackoverflow.com/questions/30570989/how-to-use-callback-for-multiple-json-array-in-retrofit to fetch mutliple json array using retrofit. – Sunil P Jul 26 '17 at 07:08
  • i want android code for that. – madhu Jul 26 '17 at 07:10
  • Your problem title and problem description do not say same thing. What I can see from your code is that you do not have issue with fetching multiple json array using retrofit. But your actual problem is how to code an adapter to get your intended layout design. Please edit your question relevantly. – nitinkumarp Jul 26 '17 at 09:47

0 Answers0