ListView, OnItemClick not being called?

故事扮演 提交于 2019-12-04 19:38:49

Since you use ListFragment you shouldn't set onItemClickListener to your list. There is already a method in ListFragment that you should override.

@Override
public void onListItemClick(ListView l, View v, int position, long id) {
    super.onListItemClick(l, v, position, id);

    //Do your thingy.
}

Use

basicList.setListAdapter(adapter);

instead of

this.setListAdapter(adapter);

Use same instance of ListView for setting Adapter and setOnItemClickListener.

you should override onListItemClick, since your class extends ListFragment. From the doc:

This method will be called when an item in the list is selected. Subclasses should override.

Here the documentation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!