lv.setOnClickListener(new OnClickListener(){
public void onClick(View v){
}
});
Does v
refer to the ListView lv
or the specific item selected in the list?
Thanks in advance.
lv.setOnClickListener(new OnClickListener(){
public void onClick(View v){
}
});
Does v
refer to the ListView lv
or the specific item selected in the list?
Thanks in advance.
I believe that v
refers to the whole ListView
. To add a click handler for an item, you want to use AdapterView.setOnItemClickListener.
onClickListener
just listens to a click on the entire View. v
will be the ListView
.
What you probably want is onItemClickListener
instead of onClickListener
.
Or you may want to extend ListActivity
and override onListItemClick()