ArrayAdapter.getPosition(项目)返回什么? [英] ArrayAdapter.getPosition(item) Returns What?

查看:707
本文介绍了ArrayAdapter.getPosition(项目)返回什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看文档说这个方法返回给定项目的位置,但你会做什么回报,如果没有这样的项目在一个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 :)

来源:<一href="http://grep$c$c.com/file/repository.grep$c$c.com/java/ext/com.google.android/android/5.0.2_r1/android/widget/ArrayAdapter.java#ArrayAdapter.getPosition%28java.lang.Object%29"相对=nofollow> grep的code

这篇关于ArrayAdapter.getPosition(项目)返回什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆