I am using the ListView, because I need to customize the ListView item, so I need to write a adapter, use to Baseadapter. The GetItem () and Getitemid () in Baseadapter are slightly confused, so finding the information on the Web draws their own insights:
Refer to this blog post: http://www.cnblogs.com/qzxia/archive/2010/10/25/1860602.html
GetItem is not an active call by the Android system, but rather provides an interface to facilitate the delivery of data when writing the OnClick method of item.
Public Object getItem (int position) is useful for overriding Onitemlongclick (adapterview<?> parent, view view, int position, long ID) , the Adapterview getitematposition (position) method can be used to obtain the item data returned by adapter GetItem, thus simplifying the development process.
But there's something missing from the above post, and the ID returned by public long getitemid (int position) is more than just giving us the Getselectedid () method call, and when we rewrite the getitemid (int Position), the returned value is actually the value of the ID in Onitemlongclick (adapterview<?> parent, view view, int position, long ID), The ID here may be the function of a custom item ID, not necessarily all item can save an integer ID, so deliberately add the Getitemid method, and then in the OnClick method to get the current click to the item ID, So that more convenient operation can be done.
Android Learning Note (v) baseadapter