How to place Checkboxes with ListView (Android)
<p>I was following the ListView official tutorial - [url]http://developer.android.com/resources/tutorials/views/hello-listview.html[/url], because I get the entries dinamically through a webservice.</p>

<p>Problem is, I want to place checkboxes at it. I have this</p>

<p>(aux (String [] aux) is previously and correctly fullfilled before this)</p>

<pre><code>//setListAdapter(new ArrayAdapter&lt;String&gt;(this, R.layout.lista, aux));
        setListAdapter(new ArrayAdapter&lt;CheckBox&gt;(this,R.layout.row, convertToListItem(aux)));

        //ListView lv = getListView();
        //lv.setTextFilterEnabled(true);
</code></pre>

<p>And I think the problem is on my row.xml</p>

<pre><code>&lt;CheckBox xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content" android:layout_height="wrap_content"
    android:textSize="14sp" android:typeface="normal" android:textStyle="normal"

    android:layout_weight="0" android:layout_gravity="left" /&gt;
</code></pre>

<p>or in this function</p>

<pre><code>private List&lt;CheckBox&gt; convertToListItem(String[] aux2){

        List&lt;CheckBox&gt; result = new ArrayList&lt;CheckBox&gt;();  
        ArrayList&lt;CheckBox&gt; boxes = new ArrayList&lt;CheckBox&gt;();

        for (String text : aux2){
            CheckBox temp = new CheckBox(this);
            temp.append(text);
            temp.setText(text,BufferType.NORMAL);
            result.add(temp);
            boxes.add(temp);

        }

        return result;
</code></pre>

<p>What happens is: it appears the checkbox, but in front instead the right text it appears "android.widget.Checkbox@...."</p>

<p>What am I doing wrong ?</p>
