I have created one listview, in this each row contain check box and the text, I need to get the some text in the list where the check box is true(checked). That’s i need to pass the text values which are selected from the list using check box.
This is my code:
gatwayList = (ListView) findViewById(R.id.gatwaylist);
ArrayList<HashMap<String,String>> wholeDetailsList = new ArrayList<HashMap<String,String>>();
for (int i = 0; i < 5; i++)
{
HashMap<String, String> map = new HashMap<String, String>();
map.put("name", "Test+ i");
//map.put("address", wrap_address);
wholeDetailsList.add(map);
}
SimpleAdapter wholeDetailsAdapter = new SimpleAdapter(this,
wholeDetailsList, R.layout.gatway_row, new String[] {"name"}, new int[] {R.id.gatwayId});
gatwayList.setCacheColorHint(0);
gatwayList.setAdapter(wholeDetailsAdapter);
gatway_row.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<CheckBox
android:id="@+id/check"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="4px"
android:layout_alignParentLeft="true"
android:layout_marginRight="10px" >
</CheckBox>
<TextView android:id="@+id/gatwayId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ffff"
android:textSize="18dip"
android:layout_marginTop="15dip"
android:layout_marginLeft="60dip"
android:textStyle="bold"
android:textColor="#000000"/>
</RelativeLayout>
The List look like

In this case i have to pass all the values. else selected value only. Any comments would be appreciated?
The following snippet i am using to get the expected Ui and functionality,
and the table layout xml element like this:
and you can get the selected item by the following code in the any of the onclick method: