开发者

Android: How can I perform a click on a ListAdapter or SimpleCursorAdapter?

So I cant figure out how to perform an onClick on my ListAdapter. Here is my code:

private void fillData(){
    Cursor constantsCursor = db.fetchAllGames();

    ListAdapter adapter =
        new SimpleCursorAdapter(this, R.layout.row, 
                constantsCursor, new String[] { "title", "console" }, new int[] {
                R.id.title, R.id.console });
    setListAdapter(adapter);


}

I want to be able to click on an item from the database, then go into a view that only contains info for that item. My class currently extends ListActi开发者_如何学Pythonvity. I've tried OnItemClickListener, but I dont know what else to use to make it work.


If your current Activity extends ListActivity then you need to override ListActivity#onListItemClick to get the clicked view from the ListView.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜