What's the purpose of item-id's in Android ListView Adapter?

前端 未结 5 1695
[愿得一人]
[愿得一人] 2020-11-29 08:37

(Not specific to ListView, but to Adapter).

I keep implementing this when I subclass BaseAdapter:

    @Override
    public long getItemId(int positio         


        
5条回答
  •  清酒与你
    2020-11-29 09:17

    If you subclass ArrayAdapter instead, you may not have to implement that method.

    Mostly I find that method useful to determine what row was clicked during onClick events, and use that ID as part of the Intent extras passed to the next activity.

提交回复
热议问题