开发者

What the purpose of the getSelectedItem() from the ListView

What the purpose of the ge开发者_开发知识库tSelectedItem() from the ListView if a list can't keep state of a selected item ?


It can keep track of a selected item if you were to use say, a checkbox or a checkedtextview, but if you want to keep track of your selected items via a "highlighted background", then it's not possible (unless you want to have a hidden checkbox)


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜