Tima Tima - 6 months ago 31
Android Question

How to hide an item in a listview in Android

I know, this question was asked before, but I haven't seen a working answer for it.

Is there any way to hide some items in a

without changing source data?

I tried to set visibility of the item view to gone, it won't be displayed anymore, but the place reserved for this item is still there.

I also set:


Without success.


You can either write your own ListAdapter or subclass one of the existing ones.

In your ListAdapter, you would simply filter out the items you do not want displayed by returning modified values for getCount(), getItem() and getItemId() as appropriate.