title: Adding dynamic linear layouts to a list view
body: <p>I am using a list view to show some data on it and using it with a custom adapter, now at an instance of time, I want to show an image view as a list item in it. For that case I have made dynamic linear layout and added the image view in it. Now I want that on some condition this image view layout should appear as the list item in the last of the list view as a new item added to the list.</p>
  
  <p>Genarating layout dynamically</p>
  
  <pre><code>LinearLayout linearLayout = new LinearLayout(UserChatActivity.this);
  
              LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
                       LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
  
              ImageView img = new ImageView(UserChatActivity.this);
              img.setImageBitmap(BitmapFactory.decodeFile(picturePath));
  
  
              linearLayout.addView(img, layoutParams);
  
  
              mList.addView(linearLayout);
  </code></pre>
  
  <p>But it is giving an error named : - Views can't be added directly in the adapterViews. I know that we have to inflate views for the adapter but how to add the new view with the previous data coming in the list.???</p>
  
  <p>Thanks</p>