You can do the following,
set Tag
to your Button
in the getView()
method of your ListView
btn.setTag(position);
then set OnClickListener
to your button,
btn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Toast.makeText(getApplicationContext(), "button position is: "+v.getTag(),
Toast.LENGTH_LONG).show();
}
});