简体   繁体   English

使用SimpleCursorAdapter在ListActivity内部点击

[英]onClick inside ListActivity using SimpleCursorAdapter

I've got a class that creates a list from a DB using SimpleCursorAdapter. 我有一个使用SimpleCursorAdapter从DB创建列表的类。 I want to add an onClick event to each item in the list but I don't know where to place the code. 我想为列表中的每个项添加一个onClick事件,但我不知道将代码放在何处。

Any help? 有帮助吗?

You would override the onListItemClick method. 您将覆盖onListItemClick方法。

@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
    Uri uri = ContentUris.withAppendedId(this.getIntent().getData(), id);
    // your code
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM