开发者

Skip a getView in Android

I currently 开发者_StackOverflow中文版have a custom listview in Android that I generate by overriding the getView method of ArrayAdapter. It works perfectly. However, in certain cases I need to "skip" an item in the list. I tried returning null, but that just gives a nullpointer error. So my question is, what can I return in getView, so that no new item is added to the list?


You could use a custom Filter.

If you have a custom ArrayAdapter you can implement a custom filter and it will filter your list by a certain criteria and then those items won't even show and won't call getView to begin with.

If this sounds like it would work for you and want some more information or example code let me know.


How about setting the visibility property of your item to View.GONE? That should do it. If there is a better way to do it, I don't know it

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜