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.
Genarating layout dynamically
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);
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.???
Thanks