You can use:
ViewGroup superView = (ViewGroup)view.getParent();
Button btn = (Button) superView.findViewById(R.id.votewButton);
Also using the array of view ids that you pass to the adapter's constructor would be a good alternative:
String[] from = {/*any collumns that you may have*/, "_id"}; // just bind a column, we don't use it
int[] = {/*any collumns that you may have*/, R.id.voteButton};
The in the ViewBinder
you'll have:
@Override
public boolean setViewValue(View view, Cursor cursor, int columnIndex) {
// only if we're binding the Button
if (view.getId == R.id.voteButton) {
int upvoted_index=cursor.getColumnIndex("upvote");
int is_upvoted = cursor.getInt(upvoted_index);
if (is_upvoted == 1) {
Button likeButton = (Button) view;
likeButton.setText("Upvoted");
return true;
}
}
return false;
}