• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps multi select in cutom listview

Hi everybody,

In a first time sorry for my english -_-'
I have a problem with my listview.
My listview is a custom listview with one imageview and two textview.
And i would like to know how to select some of items in my list using checkbox. I've tried to enable the CHOICE_MODE_MULTIPLE but without success.

this is my layout
Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="?android:attr/listPreferredItemHeight"
    android:padding="6dip">
    <ImageView
        android:id="@+id/icon"
        android:layout_width="60sp"
        android:layout_height="60sp"
        android:layout_marginRight="6dip"
        android:src="@drawable/contact_icon2" 
        />
    <LinearLayout
        android:orientation="vertical"
        android:layout_width="0dip"
        android:layout_weight="1"
        android:layout_height="fill_parent">
        <TextView
            android:id="@+id/toptext"
            android:layout_width="fill_parent"
            android:layout_height="0dip"
            android:layout_weight="1"
            android:gravity="center_vertical"
            android:textSize="20sp"
        />
        <TextView
            android:layout_width="fill_parent"
            android:layout_height="0dip"
            android:layout_weight="1"
            android:id="@+id/bottomtext"
            android:singleLine="true"
            android:ellipsize="marquee"
        />        
    </LinearLayout>
</LinearLayout>

Someone can help me

thanks in advance.
 
i've tried to set a checkbox manually in my layout.
I added this just before the last </LineaLayout>

Code:
    <CheckBox
            android:id="@+id/checkbox"
            android:layout_alignParentRight="true"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent" 
        />

With this, i have a checkbox for each items in my listview, but when i select an item, some others items are selected too (all eight items to be precise).
I don't understant why.
 
Back
Top Bottom