title: Attaching ID data to listview items
body: <p>I have an application that fetches announcements stored as xml files on a server and loads the title and author of each announcement into a ListView item. What I also need to store with each item is the ID of each announcement but I don't actually need to display it. I thought about maybe storing the ID in the hash map I use to fill the list and then find the associated ID with the title clicked but I think it would be unsafe to use since two announcements could have the same title (and author and date). I also thought about adding an invisible TextView to each item to store the ID but that was causing layout problems. Lastly, I searched around and found setTag() and getTag() which I think would be perfect for what I want to do but I'm not really sure how to use them with SimpleAdapter (I'm relatively new to this...). If the TextView idea is what I need to do (though I doubt it), here is the layout I'm using for each item:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical" &gt;
  
      &lt;TextView
        android:id="@android:id/text1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="6dip"
        android:textAppearance="?android:attr/textAppearanceMedium"/&gt;
      &lt;LinearLayout 
          android:orientation="horizontal"
          android:id="@+id/items"
          android:weightSum="100"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"&gt;
          &lt;TextView
            android:id="@android:id/text2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="6dip"
            android:textAppearance="?android:attr/textAppearanceSmall"
            android:layout_weight="85"/&gt;
          &lt;LinearLayout 
              android:orientation="vertical"
              android:id="@+id/itemCB"
              android:layout_weight="15"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:gravity="center"&gt;
              &lt;CheckBox
                  android:id="@+id/cbSelected"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content" /&gt;
          &lt;/LinearLayout&gt;
      &lt;/LinearLayout&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>And I'm using the following adapter to fill the list:</p>
  
  <pre><code>for(int i = 0; i &lt; ann.length; i++)
  {
      map = new HashMap&lt;String, String&gt;();
      map.put("line1", ann[i].getTitle());
      map.put("line2", "Posted by: " + ann[i].getAuthor() + "\n" + ann[i].date.toLongString());
      list.add(map);
  }
  String[] from = { "line1", "line2"};
  
  int[] to = { android.R.id.text1, android.R.id.text2};
  
  SimpleAdapter adapter = new SimpleAdapter(this, list, R.layout.twoline_checkbox_id_listitem, from, to);
  setListAdapter(adapter);
  </code></pre>
  
  <p>Thank you for any help!</p>