Click Listener on ListView

后端 未结 2 1846
广开言路
广开言路 2021-01-06 16:16

I have modified this example from the SDK pages to grab all the Contact Groups from the phone and display them. I cannot, however, figure out how to click one of them and t

2条回答
  •  旧时难觅i
    2021-01-06 17:11

    Since you are using ListActivity you need to override onListItemClick().

    protected void onListItemClick(ListView l, View v, int position, long id) {
        // position is the position in the adapter and id is what adapter.getItemId() returns.
        // use one of them to get the group id from the data.
    }
    

提交回复
热议问题