title: How to add CardView in RecyclerView Dynamically in Android???
body: <blockquote>
    <p>I am working on a application where I have to add <em>cardView</em> to
    <em>recyclerView</em> <em>dynamically</em>, but it is not working.</p>
    
    <p>This is my code :-</p>
  </blockquote>
  
  <pre><code>Button okBTN;
       EditText enterCornerNumberET;
       private RecyclerView mRecyclerView;
       private CornerListAdapter mAdapter;
   public int cornervalue;
  
  
  protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.corner_list);
  
  
    okBTN = (Button)findViewById(R.id.okBTN);
  
          enterCornerNumberET = (EditText)findViewById(R.id.enterCornerNumberET);
  
   mRecyclerView = (RecyclerView)findViewById(R.id.recycler_view);
  
  
   mRecyclerView.setHasFixedSize(true);
          mLayoutManager = new LinearLayoutManager(this);
          mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
          mRecyclerView.setLayoutManager(mLayoutManager);
  
  
   okBTN.setOnClickListener(this);
  
  
    @Override
      public void onClick(View v) {
  
          switch (v.getId()){
  
   case R.id.okBTN:
  
                  cornervalue = Integer.valueOf(enterCornerNumberET.getText().toString().trim());
  
                  Toast.makeText(CornerListActivity.this, ""+cornervalue, Toast.LENGTH_SHORT).show();
  
                  createCornerList(cornervalue);
  
                 /*if(enterCornerNumberET.getText().toString().trim()==null){
  
  
                      Toast.makeText(CornerListActivity.this, "Please enter corner number", Toast.LENGTH_SHORT).show();
  
                  }else{
  
                      createCornerList(cornervalue);
  
                  }*/
  
  
                  break;
  
  }
  }
  
   private void createCornerList(int cornervalue) {
  
  
          for (int i = 0; i &lt; cornervalue; i++) {
  
              mAdapter=new CornerListAdapter(this,roofCornerArrayList);
              mRecyclerView.setAdapter(mAdapter);
          }
      }
  </code></pre>
  
  <blockquote>
    <p>Please have a look and let me know what mistake I am doing here. Thanks in advance. :)</p>
  </blockquote>