title: how to parse data on recyclerview using retrofit 2 with given json
body: <p>Hello im new with retrofit and json. i have a given json and want to display data in recyclerview. I tried to parse data in getWorkQueue() but something goes wrong.</p>
  
  <p>myJson</p>
  
  <pre><code>[
      {
          ""REQUEST_NO"": ""CR-201718-6"",
          ""PROCESS_NAME"": ""CONVEYANCE REIMBURSEMENT"",
          ""STEPNAME"": null,
          ""PROCESSID"": 1,
          ""INSTANCEID"": 6,
          ""AMOUNT"": 250,
          ""RAISED_BY"": ""flologic1"",
          ""RAISED_DATE"": ""12-Sep-2017"",
          ""APPROVED_BY"": ""Flologic2"",
          ""APPROVED_DATE"": null,
          ""BRANCH"": ""101""
      }
  ]
  </code></pre>
  
  <p>WorkQueueAdapter.java</p>
  
  <p>public class WorkQueueAdapter extends RecyclerView.Adapter {</p>
  
  <pre><code>private List&lt;TravelWorkQueue&gt; mDataset;
  private Context context;
  
  public WorkQueueAdapter(List&lt;TravelWorkQueue&gt; myDataset, Context mContext) {
      this.mDataset = myDataset;
      this.context = mContext;
  }
  
  @Override
  public void onBindViewHolder(DataObjectHolder viewHolder, final int position) {
  
      TravelWorkQueue queue = mDataset.get(position);
      viewHolder.raisedBy.setText(queue.getRaisedBy());
      viewHolder.requestNo.setText(queue.getRequestNo());
      viewHolder.trdate.setText(queue.getRaisedDate());
      viewHolder.processName.setText(queue.getProcessName());
  
  }
  
  @Override
  public int getItemCount() {
      return mDataset.size();
  }
  
  public static class DataObjectHolder extends RecyclerView.ViewHolder {
  
      TextView raisedBy, requestNo, trdate, processName;
      LinearLayout linearLayout;
  
      public DataObjectHolder(View itemView) {
          super(itemView);
          raisedBy = (TextView) itemView.findViewById(R.id.raisedBy);
          requestNo = (TextView) itemView.findViewById(R.id.requestNo);
          trdate = (TextView) itemView.findViewById(R.id.trDate);
          processName = (TextView) itemView.findViewById(R.id.processName);
  
          linearLayout = (LinearLayout) itemView.findViewById(R.id.linearIteam);
      }
  
  }
  
  @Override
  public DataObjectHolder onCreateViewHolder(ViewGroup parent, int viewType) {
      View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.work_queue_list, parent, false);
      return new DataObjectHolder(view);
  }
  </code></pre>
  
  <p>}</p>
  
  <p>And fragment class</p>
  
  <p>public class WorkQueue extends Fragment {</p>
  
  <pre><code>public static final String TAG = WorkQueue.class.getSimpleName();
  private View rootView;
  private ListView myRequestList;
  private RecyclerView.LayoutManager mLayoutManager;
  private WorkQueueAdapter mAdapter;
  
  private RecyclerView mRecyclerView;
  String userName = "flologic2";
  
  private TravelWorkQueue travelWorkQueue;
  List&lt;TravelWorkQueue&gt; travelWorkQueues;
  
  @Nullable
  @Override
  public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
      rootView = inflater.inflate(R.layout.work_queue, container, false);
  
      //  userName = getParent().getUserName();
      mRecyclerView = (RecyclerView) rootView.findViewById(R.id.my_recycler_view);
  
      mRecyclerView.setHasFixedSize(true);
      mLayoutManager = new LinearLayoutManager(getActivity());
      mRecyclerView.setLayoutManager(mLayoutManager);
      travelWorkQueues = new ArrayList&lt;&gt;();
      // TravelRequestService  travelRequestService = HDFCService.getTravelRequestService();
  
      getWorkQueue();
  
      return rootView;
  }
  
  private HomeActivity getParent() {
      return (HomeActivity) getActivity();
  }
  
  private void getWorkQueue() {
  
      Call&lt;List&lt;TravelWorkQueue&gt;&gt; call = HDFCService.getTravelRequestService().getRequestQueqeDetails(userName);
      call.enqueue(new Callback&lt;List&lt;TravelWorkQueue&gt;&gt;() {
          @Override
          public void onResponse(Call&lt;List&lt;TravelWorkQueue&gt;&gt; call, Response&lt;List&lt;TravelWorkQueue&gt;&gt; response) {
  
              List&lt;TravelWorkQueue&gt; list = response.body();
              TravelWorkQueue workQueue = null;
  
              //int i=0;
             for (int i = 0; i &lt; list.size(); i++) {
                  workQueue = new TravelWorkQueue();
                  String requestNo = list.get(i).getRequestNo();
                  String raisedBy = list.get(i).getApproverBy();
                  String raisedDate = list.get(i).getRaisedDate();
                  String processName = list.get(i).getProcessName();
  
                  workQueue.setRequestNo(requestNo);
                  workQueue.setRaisedBy(raisedBy);
                  workQueue.setRaisedDate(raisedDate);
                  workQueue.setProcessName(processName);
  
                  list.add(workQueue);
              i++;
  
  
                  mAdapter = new WorkQueueAdapter(travelWorkQueues, getActivity());
                  mRecyclerView.setAdapter(mAdapter);
              }
          }
  
          @Override
          public void onFailure(Call&lt;List&lt;TravelWorkQueue&gt;&gt; call, Throwable t) {
  
              Toast.makeText(getActivity(), "Failed", Toast.LENGTH_LONG).show();
          }
      });}}
  </code></pre>