I have ListView.
I have 3 sets of views:
I have a webserver which returns images, videos and
Associate each webservice response with ID 0-for Images, 1-for Texts and 2-for Videos. Store ID in a ArrayList. Then Override getItemViewType() and getViewTypeCount(). Inflate appropriate views in getView().
@Override
public int getItemViewType(int position)
{
int type;
if (ID.get(position)== 0){
type = TYPE_ITEM1; //type 0 for image
} else if (ID.get(position) == 1){
type = TYPE_ITEM2; //type 1 for text
}else {
type = TYPE_ITEM3; //type 2 for videos
}
return type;
}
@Override
public int getViewTypeCount() {
return 3; //three different layouts to be inflated
}