title: RecyclerView Not showing data from Json array
body: <p>Whenever i try to add data to recycler view, the recycler view doesn't show any data. I tried debugging the program and I am successfully getting  JSON data using Retrofit into the application(Checked by printing it in Log). But RecyclerView shows no data.Here is my code:</p>
  
  <p>CartActivity.java</p>
  
  <pre><code> public class CartActivity extends AppCompatActivity {
  RecyclerView listshowrcy;
  List&lt;CartDisplay&gt;  cartlist = new ArrayList&lt;&gt;();
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_cart);
  
      Retrofit retrofit = new Retrofit.Builder()
              .baseUrl(API.BASE_URL)
              .addConverterFactory(GsonConverterFactory.create())
              .build();
      API api = retrofit.create(API.class);
      String username = getIntent().getStringExtra("Username");
      Call&lt;List&lt;CartDisplay&gt;&gt; call = api.getCartContent(username);
      call.enqueue(new Callback&lt;List&lt;CartDisplay&gt;&gt;() {
          @Override
          public void onResponse(Call&lt;List&lt;CartDisplay&gt;&gt; call, Response&lt;List&lt;CartDisplay&gt;&gt; response) {
              List&lt;CartDisplay&gt; cart = response.body();
              for(CartDisplay cartContent : cart){
                  cartlist.add(cartContent);
              }
          }
  
          @Override
          public void onFailure(Call&lt;List&lt;CartDisplay&gt;&gt; call, Throwable t) {
  
          }
      });
  
      listshowrcy = (RecyclerView)findViewById(R.id.cartList);
      listshowrcy.setHasFixedSize(true);
      CartAdapter cardadapter = new CartAdapter(cartlist,this,username);
      listshowrcy.setAdapter(cardadapter);
      LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
      listshowrcy.setLayoutManager(linearLayoutManager);
  
  
  
  }
  }
  </code></pre>
  
  <p>CartAdapter.java</p>
  
  <pre><code>public class CartAdapter extends RecyclerView.Adapter&lt;CartAdapter.Holderview&gt; {
  private List&lt;CartDisplay&gt; cartlist;
  private Context context;
  private String username;
  
  public CartAdapter(List&lt;CartDisplay&gt; cartlist, Context context,String username) {
      this.cartlist = cartlist;
      this.context = context;
      this.username = username;
  }
  
  @Override
  public Holderview onCreateViewHolder(ViewGroup parent, int viewType) {
      View layout = LayoutInflater.from(parent.getContext()).inflate(R.layout.cart_item,parent,false);
      return new Holderview(layout);
  }
  
  @Override
  public void onBindViewHolder(Holderview holder, int position) {
      holder.pname.setText(cartlist.get(position).getP_name());
      holder.pquant.setText(cartlist.get(position).getQuantity());
      holder.price.setText(String.valueOf(cartlist.get(position).getPrice()));
  }
  
  @Override
  public int getItemCount() {
      return cartlist.size();
  }
  
  class Holderview extends RecyclerView.ViewHolder
  {
      TextView pname;
      TextView pquant;
      TextView price;
  
      Holderview(View itemview){
          super(itemview);
          pname = (TextView)itemview.findViewById(R.id.product_name);
          pquant = (TextView)itemview.findViewById(R.id.product_quant);
          price = (TextView)itemview.findViewById(R.id.product_price);
      }
  
  }
  
  }
  </code></pre>