Forum General

Using CheckBox in a customized ListView

I´m using checkbox for select any students in a listview, but I don´t used the check standart of the listview, I catch a diferent one.

The problem ocurred when I try to rescue the values, that are checked.

The list not understand.

This is the part of code, that I try to rescue the values.

            void Gravar_Click(object sender, EventArgs e)

        //ListView listView = FindViewById<ListView> (Resource.Id.lsv_Chamar);

        //listView.Adapter = new adapter_list (this, chamada);

        var builder = new StringBuilder();
        var sparseArray = FindViewById<ListView> (Resource.Id.lsv_Chamar).CheckedItemPositions;
        TextView text = FindViewById<TextView> (Resource.Id.txt_Prefixo);
        CheckBox check = FindViewById<CheckBox> (Resource.Id.checkBox1);

        for (var i = 0; i < sparseArray.Size(); i++) 
                if (check.Checked) 
                    builder.AppendLine (text.Text);


        ShowAlert ("ListView", builder.ToString ()); 


Help me!

Sign In or Register to comment.