title: Android - ListView dynamic Buttons for each row calling dynamic listeners
body: <p>I'm new to android, i've spent the last 2 days trying previous examples and online solutions but I just can't seem to get my head around it :(</p>
  
  <p>I'm able to display a list view, parse some json from online and store a book title, book description and book ID and display this data in the listview. I want to be able to put a 'download' button in each row for the ListView, each button will correspond to its book ID on Click() and the action listener will download the book by appending that ID to a url.
  e.g www.books.com/download_book1    or /download_book2....</p>
  
  <p>Here is my code. Catalogue.java class</p>
  
  <pre><code>public class Catalogue extends ListActivity {
  
  private JSONObject json;
  private ListView lv;
  
  private ArrayList&lt;Integer&gt; alKey = new ArrayList&lt;Integer&gt;();
  
  @Override
      public void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState); //icicle
              setContentView(R.layout.shelflist);
              ArrayList&lt;HashMap&lt;String, String&gt;&gt; mylist = new ArrayList&lt;HashMap&lt;String, String&gt;&gt;();
  
  
  ....
  try{
  
                  JSONArray entries = json.getJSONArray("entries");
  
                  for(int i=0;i&lt;entries.length();i++){                        
                      HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();    
                      JSONObject e = entries.getJSONObject(i);
  
                      alKey.add(e.getInt("key")); 
                      map.put("id",  String.valueOf(i));
                      map.put("title", "Title:" + e.getString("title"));
                      map.put("description", "Description: " +  e.getString("description"));
                      mylist.add(map);
  
  
                  }       
              }catch(JSONException e)        {
                   Log.e("log_tag", "Error parsing data "+e.toString());
              }
  
              ListAdapter adapter = new SimpleAdapter(this, mylist , R.layout.shelfrow, 
                              new String[] { "title", "description" }, 
                              new int[] { R.id.item_title, R.id.item_subtitle });
  
              setListAdapter(adapter);
  
                      lv = getListView();
                      lv.setTextFilterEnabled(true);  
  </code></pre>
  
  <p>.....</p>
  
  <p>This is as far as I get. I don't know how to add 1 button per row in the List and assign an action listener to each button.
  I also have a shelfrow.xml file (textView, textView for item_title and item_subtitle) and a shelflist.xml file (ListView). 
  I have a shelf.xml file with </p>