ArrayAdapter.getPosition(item) Returns What?

。_饼干妹妹 提交于 2019-12-20 11:03:54

问题


I see the documentation says this method returns the position of the given item, but what would it return if no such item exists in the ArrayAdapter?


回答1:


After looking through the source code I've found that the ArrayAdapter uses List.indexOf(Object) to find the object and this method returns -1 when it doesn't exist.

GrepCode is awesome for finding stuff when the documentation is bad, I use it at least once a day :)

Source: GrepCode



来源:https://stackoverflow.com/questions/6715222/arrayadapter-getpositionitem-returns-what

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!