Reputation: 5642
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 ListActivity. I've tried OnItemClickListener, but I dont know what else to use to make it work.
Upvotes: 1
Views: 1523
Reputation: 41972
If your current Activity
extends ListActivity
then you need to override ListActivity#onListItemClick
to get the clicked view from the ListView
.
Upvotes: 2