What the purpose of the getSelectedItem() from the ListView

前端 未结 2 1050
旧巷少年郎
旧巷少年郎 2021-01-25 03:52

What the purpose of the getSelectedItem() from the ListView if a list can\'t keep state of a selected item ?

2条回答
  •  甜味超标
    2021-01-25 04:17

    getSelectedItem() is actually quite useless for ListView. getSelectedItem is defined in AdapterView, so there are other widgets that make better use of this method.

    If you need to access the current item when it's selected, set the appropriate OnItemClickListener or OnItemLongClickListener.

提交回复
热议问题