I have a custom listview and a radio button in each row, it works properly but i want to reach id of selected radio button from this code. For example when i need the textview1
Assuming that you need to access the TextView
in the onClick
method,
@Override
public void onClick(View v) {
if((position != mSelectedPosition && mSelectedRB != null)){
mSelectedRB.setChecked(false);
}
mSelectedPosition = position;
mSelectedRB = (RadioButton)v;
View containerView = (View)v.getParent();
TextView textView1 = (TextView)containerView.findViewById(R.id.TextView01);
}
EDIT:
I see that you have declared the holder
object as final
. In that case, you can directly access the holder.text1
and holder.text2
objects from within the event listener.