Getting radio button value from custom list in android

前端 未结 3 1867
深忆病人
深忆病人 2021-01-25 09:32

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

3条回答
  •  不知归路
    2021-01-25 10:34

    I want to reach id of selected radio button from this code.

    You have to play with setTag & get getTag property to fetch actual id of your selected radio button,

    holder.button.setTag(position);  
    
    holder.button.setOnClickListener(new View.OnClickListener() {  
                    public void onClick(View v) {   
                     int pos = (Integer) v.getTag();
                     Log.i("ID of radiobutton","Order Edit @ position : " + pos); 
                     String _Str1=array1.get(pos);
                     String _Str2=array2.get(pos);
                     }       
                    });  
    

    This way you will get the exact values of textview from your rows.

提交回复
热议问题