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?
You can use this adapter to provide views for an AdapterView , Returns a view for each object in a collection of data objects you provide, and can be used with list-based user interface widgets such as ListView or Spinner .
Parameters. The current context. This value can not be null. The resource ID for the layout file containing a layout to use when instantiating views.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With