listview with checkbox single clickable
===

i have a listivew with custom arrayadapter and custom layout, it have a Checkbox.
I want to make this listview only one checkbox enabled but i dont know how can i do it.

This is my adapter, but the check and uncheck dont works fine. Any exmple please.

  

public class gremioAdapter extends ArrayAdapter<Gremio> {

    Context context;
    int layoutResourceId;
    ArrayList<Gremio> data = null;
    protected String comentarioAlEdiText;

    public gremioAdapter(Context context, int layoutResourceId, ArrayList<Gremio> data)
    {
        super(context, layoutResourceId, data);
        this.layoutResourceId = layoutResourceId;
        this.context = context;
        this.data = data;
    }

    public void updateDataSet(Gremio objetoGremioAnadir) {
        this.data.add(objetoGremioAnadir);
        notifyDataSetChanged();

    }

    public void updateDataSet(Gremio objetoGremioAnadir, int posicion) {
        this.data.add(posicion, objetoGremioAnadir);
        notifyDataSetChanged();

    }

    public void updateDataSet(String comentario, int posicion) {
        this.data.get(posicion).comentario = comentario;
        notifyDataSetChanged();

    }
    public void updateDataSet() {
        
        notifyDataSetChanged();

    }

    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        View row = convertView;
        GremioHolder holder = null;
        final GremioHolder h2 = holder;


        if (row == null) {
            LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            row = inflater.inflate(layoutResourceId, parent, false);

            holder = new GremioHolder();
            holder.tvGremio = (TextView) row.findViewById(R.id.tvGremio);
            holder.cbActivo = (CheckBox) row.findViewById(R.id.cbGremioActivo);
            holder.tvComentario = (TextView) row.findViewById(R.id.tvComentario);

            row.setTag(holder);
        }
        else {
            holder = (GremioHolder) row.getTag();
        }

        Gremio gremioFinal = data.get(position);
        
        holder.tvGremio.setText(gremioFinal.literal);
        holder.tvComentario.setText(gremioFinal.comentario);

        if (data.get(position).getActivo().equals("1")) {
            holder.cbActivo.setChecked(true);
        }
        else {
            holder.cbActivo.setChecked(false);
        }

        holder.cbActivo.setOnClickListener(new OnClickListener()
        {

            
            @Override
            public void onClick(View v) {
                if (data.get(position).activo.equals("0"))
                    h2.cbActivo.setChecked(true);
                if (data.get(position).activo.equals("1"))
                    h2.cbActivo.setChecked(false);

            }
        });
        holder.cbActivo.setOnCheckedChangeListener(new OnCheckedChangeListener()
        {
                @Override
                public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {

                    if (!isChecked) {
                        for (int i = 0; i < data.size(); i++) {
                            data.get(i).activo = "0";
                        }
                        data.get(position).activo = "1";
                    }
                    if (isChecked) {
                        for (int i = 0; i < data.size(); i++) {
                            data.get(i).activo = "0";
                        }
                    }
                    
                    notifyDataSetChanged();

                }
            });

            return row;
        }

        public class GremioHolder {
            TextView tvGremio;
            CheckBox cbActivo;
            TextView tvComentario;
        }
    }

}
