android - How to use checkbox in listview (which have multilines in each list) and extends Listactivity? -


this program extends listactivity , in each list have multilines, picture , checkbox try this

public void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.main);      list<map<string, object>> resourcenames =new arraylist<map<string, object>>();      map<string, object> data1,data2;      data1 = new hashmap<string, object>();     data2 = new hashmap<string, object>();        data1.put("line1", "adidas chelsea tee-womens" );       data1.put("line2", "$ 129.0" );       data1.put("img", r.drawable.q1 );       resourcenames.add(data1);       data2.put("line1", "chelsea track top-womens" );       data2.put("line2", "$ 399.0" );       data2.put("img", r.drawable.q2 );  resourcenames.add(data2); simpleadapter notes = new simpleadapter(         this,         resourcenames,         r.layout.row,         new string[] {"line1","line2", "img" },         new int[] { r.id.text1, r.id.text2, r.id.img } );     setlistadapter(notes); } 

and wonder how value each checkbox in each list

this row.xml

<?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"> <checkbox   android:id="@+id/checkbox1"  android:layout_width="wrap_content"  android:layout_height="wrap_content"></checkbox> <imageview     android:id="@+id/img"     android:layout_width="wrap_content"     android:layout_height="fill_parent"     android:layout_marginright="6dip"     android:src="@drawable/icon" /> <linearlayout     android:orientation="vertical"     android:layout_width="0dip"     android:layout_weight="1"     android:layout_height="fill_parent">     <textview         android:id="@+id/text1"         android:layout_width="fill_parent"         android:layout_height="0dip"         android:layout_weight="2"         android:gravity="center_vertical"     />     <textview         android:layout_width="fill_parent"         android:layout_height="0dip"         android:layout_weight="1"         android:id="@+id/text2"         android:singleline="true"         android:ellipsize="marquee"     /> </linearlayout> 

thanks.

take here http://www.mousetech.com/blog/?p=74 , android custom listview unable click on items

to summarize summarized blog, if list item contains focusable item, item click events. set focusable attribute on checkbox false prevent happening.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -