One way you can, but I don't know if this is perfect or not.
track the identifier of the position of the list on which the switch was set when you click on another switch, then implement setOnCheckedChangeListener(listener) and check the position that has already been checked, and uncheck this radio book.
You can save the switch status in a user model (Model, which contains controls such as textview, imageview, radioobutton, etc. for one line of the list) that has been added to the list
check this article to use the model and process the component in the list in this example check box example
Update
I think you can get the tag this way
((View)((ViewGroup)listview.getItemAtPosition(0)).getTag()).getTag(); or ((Button)l.getItemAtPosition(0)).getTag();
update 2
suppose this is your adapter and arraylist object
private List<Model> list_model = new ArrayList<Model>(); private ArrayAdapter<Model> modelAdapter;
you class Model is as follows
private class Model{ private String text1 = ""; private boolean isChecked = false; public Model(String text1){ this.text1 = text1; isChecked = false; } }
your viewer
private static class ViewHolder{ TextView textView; RadioButton radioBtn; }
pass listmodel to this CustomAdapter class in the constructor
private List<Model> list; private Context context; public CustomAdapter(Context context, List<Model> list){ super(context,R.layout.list_layout,list); this.list = list; this.context = context; }
now in getView()
@Override public View getView(int position, View convertView, ViewGroup parent) { View view = null; if(convertView == null){ LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflater.inflate(R.layout.gcalendar_list_layout, null); final ViewHolder viewHolder = new ViewHolder(); viewHolder.textView = (TextView) view.findViewById(R.id.text1); viewHolder.radioBtn = (RadioButton) view.findViewById(R.id.radioBtn); viewHolder.radioBtn.setOnCheckedChangeListener(new OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { Model element = (Model) viewHolder.checkBox.getTag(); element.isChecked = buttonView.isChecked(); boolean isChecked = true; for(int i=0;i<list.size();i++){ if(!list.get(i).isChecked){ list.get(i).isChecked=false;