@Override
 public int getItemViewType(int position) {
   LeaveHistoryData oList;
   oList = nList.get(position);
   switch (oList.getHead().toUpperCase()) {
     case "FIRST":
       return 1;
     case "HEADER":
       return 2;
     case "ITEM":
       return 3;
   }
   return 4;
 }
  @Override
  public void onBindViewHolder(final ViewHolder holder, final int position) {
    LeaveHistoryData oList;
    oList = nList.get(position);
    holder.hdate.setText(oList.getDate());
    holder.htype.setText(oList.getType());
    holder.hdesc.setText(oList.getDesc());
    holder.hnumday.setText(oList.getNumdays());
    if (oList.getStatus().equalsIgnoreCase("applied")) {
      holder.dalfa.setTextColor(Color.YELLOW);
      holder.hnumday.setTextColor(Color.YELLOW);
    }
    if (oList.getStatus().equalsIgnoreCase("approved")) {
      holder.dalfa.setTextColor(Color.GREEN);
      holder.hnumday.setTextColor(Color.GREEN);
    }
    if (oList.getStatus().equalsIgnoreCase("rejected")) {
      holder.dalfa.setTextColor(Color.RED);
      holder.hnumday.setTextColor(Color.RED);
    }

    try {
      switch (getItemViewType(position)) {
        case 1:
          holder.monthtext.setText(oList.getMonth());
          holder.divider.setVisibility(View.GONE);
          break;
        case 2:
          holder.monthtext.setText(oList.getMonth());
          break;
        case 3:
          holder.sep.setVisibility(View.GONE);
          break;
        default:
          break;
      }
    } catch (IndexOutOfBoundsException e) {

    } catch (NullPointerException e) {
    }
    /*  try {
     if (oList.getHead().equalsIgnoreCase("first")) {
         holder.monthtext.setText(oList.getMonth());
         holder.divider.setVisibility(View.GONE);
     }
     if(oList.getHead().equalsIgnoreCase("header")){
         holder.monthtext.setText(oList.getMonth());
     }
     if(oList.getHead().equalsIgnoreCase("Item")){
         holder.sep.setVisibility(View.GONE);
     }
    */
    /* } else if (nList.get(position).getMonth().equalsIgnoreCase(nList.get(position - 1).getMonth())) {
        holder.sep.setVisibility(View.GONE);
    } else {
        holder.monthtext.setText(oList.getMonth());
    }*/
    /*
    } catch (IndexOutOfBoundsException e) {

    } catch (NullPointerException e) {
    }*/
  }