开发者

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

开发者 https://www.devze.com 2023-01-08 04:39 出处:网络
So I cant figure out how to perform an onClick on my ListAdapter. Here is my code: private void fillData(){

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

精彩评论

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