views:

24

answers:

1

Is there some place which describes the contract between Adapter and AdapterView, or between ListView and ListViewAdapter.

I'm trying to create my own ListView Adapter. It is not clear to me the sequence of method invocations nor who maybe calling these methods.

There appear to be several overlapping methods.

  • getItem returns a data object, but you don't know the type.
  • getItemViewType returns an integer. Who determines the integer? Are they defined somewhere? Userdefined?
  • getView

getView seems to be the only one that really matters. What other code maybe involved that would try to do something with the returned data and returned view? How can this other code know how to assign the data to the view if the type of neither is known?

A general explanation of the design would be helpful.

A: 

I think you will have to look into android source code :
http://www.google.co.in/codesearch/p?hl=fr#uX1GffpyOZk/core/java/android/widget/AdapterView.java&q=adapterView&sa=N&cd=1&ct=rc

Sephy
Ok, thanks. Generally looks like getItem is for developer use to extra the data from selected rows.I'm still confused why getItemViewType is used within Android.
David