I have a custom BaseAdapter
for my ListView
in which i implements AdapterView.OnItemClickListener
.
The problem is the onItem
With custom adapter OnItemClickListener does not work. You must register onClickListener on view in getView method.
public View getView(int position, View convertView, ViewGroup parent)
{
LayoutInflater layoutInflater = (LayoutInflater) this.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
/**
* Inflating the root view and all his children and set them to a View Object.
*
*/
View row = layoutInflater.inflate(R.layout.list_view_row,null);
// Get all the views in my row
this.a = (TextView) row.findViewById(R.id.a_id;
MyListViewRow myListViewRow = rowsList.get(position);
// Set values to all the views in my row
this.a.setText(myListViewRow.getA());
row.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// do your stuff
}
});
return row;
}