I am loading list view by listview adapter class. Within that list view I have button called favorite.
ImageButton mFavorite = (ImageButton) convertView.findViewById(R.id.method_fav_btn);
There are multiple image buttons under the same id. I want to identify which button was pressed by means of setting some extra parameters to it. I am doing this for that:
mFavorite.setId(pm.getId());
And on click:
mFavorite.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
System.out.println("Id is: "+mFavorite.getId());
}
});
But, the problem is, I have 3 items in list view. Every time I am getting same id. How to get different ids on different clicks? Thanks.