具有 ResourceCursorAdapter 的 ListView 的项目单击侦听器

发布于 2025-01-07 05:21:23 字数 519 浏览 3 评论 0原文

如何在使用 ResourceCursorAdapter 时向 ListView 提供 onItemClickListene

我有一个扩展 ListActivity 的类,

我尝试了很多事情,例如

1) 实现 OnItemSelectedListener 并通过设置 onItemSelected 覆盖>getListView().setOnItemSelectedListener(this);

但是这种方法失败了,因为上面的方法适用于适配器,我猜不适用于 ResourceCursorAdapter。

2)我尝试仅添加 getListView().setOnItemClickListener(listener) 但这也不会调用。

3)我也尝试覆盖 onListItemClick(l, v,position,id) ,但是也没有被调用。

现在我真的不知道如何使 ResourceCursorAdapter 可点击列表视图

How to provide a onItemClickListene to ListView when ResourceCursorAdapter is used

I have a class which extends ListActivity

I have tried so many things like

1) Implementing OnItemSelectedListener and overriding onItemSelected by setting getListView().setOnItemSelectedListener(this);

But this approach fails as the above would work for Adapters i guess not for ResourceCursorAdapter.

2) I tried adding only getListView().setOnItemClickListener(listener) but that doesn't call too.

3) I tried overriding onListItemClick(l, v, position, id) too , but that doesn't get call too.

Now i really don't know how can i make a listview clickable for ResourceCursorAdapter

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文