What is the intent of the methods getItem and getItemId in the Android class BaseAdapter?

前端 未结 6 1493
清歌不尽
清歌不尽 2020-11-27 11:47

I\'m curious about the purpose of the methods getItem and getItemId in the class Adapter in the Android SDK.

From the description, it seems that getItem

6条回答
  •  爱一瞬间的悲伤
    2020-11-27 12:11

    The getItemId method is largely designed to work with Cursors that are backed by SQLite databases. It will return the underlying cursor's id field for the item in position 1.

    In your case there isn't an id for the item in position 1: I'm assuming ArrayAdapter's implementation just returns -1 or 0.

    EDIT: actually, it just returns the position: in this case 1.

提交回复
热议问题