ArrayAdapter.getPosition(项目)返回什么?项目、ArrayAdapter、getPosition

由网友(奶油味小仙女)分享简介:我看文档说这个方法返回给定项目的位置,但你会做什么回报,如果没有这样的项目在一个ArrayAdapter?I see the documentation says this method returns the position of the given item, but what would it return...

我看文档说这个方法返回给定项目的位置,但你会做什么回报,如果没有这样的项目在一个ArrayAdapter?

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?

推荐答案

在翻翻源$ C ​​$ C我发现一个ArrayAdapter使用的 List.indexOf(对象) 找对象,并且此方法返回-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.

grep的code是真棒寻找东西时,文档是坏的,我用它至少每天一次:)

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

来源: grep的code

阅读全文

相关推荐

最新文章