Solution is simple
in Your Adapter class take a int array like this
int visibilities[]={ImageView.VISIBLE,ImageView.GONE,ImageView.INVISIBLE};
if you are setting the images from the Drawable Resources than You probably pass the ids to the ArrayList items
something like this
CountriesList.add(new Country("India",R.drawable.india));
Than create another variable in the Country class(Your Bean class(Getter setter class))
and set it type int
something like this
class Country{
String name;
int flag;
int visibility;
}
pass the visibility like this while adding elements to your list
CountriesList.add(new Country("India",R.drawable.india,1));
And in your getView() method of the Adapter you will probably set the resource like this
holder.image.setImageResource(country.getFlag());
also add this line
holder.image.setVisibility(visibilities[country.getVisibility]);
In order to explain this I have added country example.. I Have used the same trick in my previous app for the list... and it worked like charm.. I hope this will help you.