views:

32

answers:

1

Hi,

when my ListView is being filled by a custom Array Adapter, I check for a certain parameter in the current list item, and if it is false, I want to return an empty row. At the moment, I am doing this by inflating an empty xml file, but that creates ugly list item dividers when a number of items should not be shown, and is obviously not the best way ;-)!

    if (list.get(position).equals("i-dont-want-this-in-the-list-view")){
        View empty=inflater.inflate(R.layout.empty_row, parent, false);
        return(empty);
    }

I have tried to return "null", but it clearly expects a View to be returned. Is there anything I could do without having to filter the list that is being used for the ListView beforehand (I want to keep it intact as I am doing other things with it, too).

Thanks,

Nick

A: 

Inflate a View and setVisibility to VIEW.GONE

Pentium10
Thanks for your answer! Your suggestion doesn't stop the gray list-item dividers from piling up when a lot of items in a list are being hidden with `VIEW.GONE` (which is what I wanted to do), but i guess there isn't a way to do this :-/...
Nick