I am binding Checkbox
using Custom ListView
. Now, at the last, I want all the values of checked CheckBox
.
How to get this ? I want to know that how can I get values using my code. ListView itemOnClickListener
is not firing here.
My code :
Map<String, String> m = null;
for (int i = 0; i < lList.size(); i++) {
objSubCatData = lList.get(i);
lstSubCatId.add(objSubCatData.getSubCatId());
m = new HashMap<String, String>();
m.put("SubCatName", objSubCatData.getSubCatName());
aaSubCategory.add(m);
}
final SimpleAdapter adapter = new SimpleAdapter(UserInterest.this, aaSubCategory, R.layout.userinterest_1, new String[] { "SubCatName" }, new int[] { R.id.chkUserInterest });
lvUserInterest.setAdapter(adapter);
layout1.xml :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/datalist"
android:orientation="vertical" >
<CheckBox
android:id="@+id/chkUserInterest"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="@color/blue"
android:textSize="14sp" >
</CheckBox>
</LinearLayout>
Layout2.xml :
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ListView
android:id="@+id/lvUserInterest"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="8dp"
android:divider="#b5b5b5"
android:dividerHeight="1dp" />
<Button
android:id="@+id/btnUTSubmit"
android:layout_width="130dp"
android:layout_height="35dp"
android:layout_gravity="center"
android:layout_marginTop="6dp"
android:background="@drawable/blue_bg"
android:text="@string/Submit"
android:textColor="@color/white" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="@string/userinterest"
android:textColor="@color/gray" />
</LinearLayout>