Custom view with button in ArrayAdapter

I have defined a custom view (xml) for my ArrayAdapter for a ListView, which adds a Button. I’d like to create an OnClickListener for this Button per row, yet without creating a custom adapter. Is that possible, or does Android force me to create a custom ArrayAdapter for my ListView?

Here’s a snippet of what I’m doing:

Now I’d like to add an OnClickListener for the Button in my custom view.

Thanks in advance,


You have to implement you own Adapter & in getView() method set OnClickListener on your button. Here kick off example:

ViewHolder here for optimization. You can read approximately this there.