I am writing a custom adapter for use with a
Adapter interface includes a
getItem() method which returns, according to the docs, an
the data item associated with the specified position in the data set.
What’s this object supposed to be? I can only imagine the
ListView wants to call either
equals on it, since there’s not much else you can do with a raw
Object. But I don’t have a convenient
Object I can return, and in any event I’m overriding
getView so the ListView has no need for a String from my dataset anyway.
Can I just return
null or something else completely irrelevant?
If each item in the ListView represents some object, say a String, then you can return the String here. This is useful for your controller layer if it needs to be able to perform some logic when, eg. the user taps that item in the ListView.
Returning null is fine as the usage is up to you.
I’ve personally never returned anything but null here.