Get click from button on every row in listview

I generated a ListView as seen below

I don't have enough rep to post images, you'll have to decipher my URL: image

The blue rows in the above image are populated using HashMap:

private void showListView(JSONArray rows, JSONArray totals){

final ListView list = (ListView) findViewById(;
ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>();
HashMap<String, String> map;
String[] titles = new String[]{"recordID","date","description","num1","num2"};
SimpleAdapter mSchedule = null;


    for(int i=0;i<rows.length();i++){
        map = new HashMap<String, String>();
        for(int n=0;n<allRows.getJSONArray(i).length();n++){
            map.put(titles[n], allRows.getJSONArray(i).getString(n));

    mSchedule = new SimpleAdapter(
        new int[] {,,,,}


}catch(Exception e){
    Log.e("Creating ListView", e.toString());


<LinearLayout >

<LinearLayout >
    <LinearLayout >
        <TextView (recordID) />
        <TextView (date) />
        <TextView (num1) />
        <TextView (num2) />
    <TextView (description) />

<LinearLayout (When this one is clicked) >
    <ImageView />

When the green button in the above image is clicked, Id like to get the blue row information.

(date, description, num1, num2)

Also, if you think there's a better way to populate the ListView, please let me know.


You will need to implement your own custom adapter by extending BaseAdapter. In the getView method you'll need to bind to that Button's click event. I suggest having one instance of OnClickListener and using AdapterView#getPositionForView. Once you have the position for the view holding the button that was clicked then you can get to your data. Either via Adapter#getItem or directly from your data source.

Need Your Help

Enumerated TabPages in a MenuStrip - Click event

c# winforms menu tabs

I am displaying all tab pages from a WinForms TabControl into a MenuStrip.

Getting Http Status code number (200, 301, 404, etc.) from HttpWebRequest and HttpWebResponse

c# .net http httpwebrequest

I am trying to get the HTTP status code number from the HttpWebResponse object returned from a HttpWebRequest. I was hoping to get the actual numbers (200, 301,302, 404, etc.) rather than the text