title: Set contentDescription dynamically when populating list of TextViews
body: <p>I'm trying to update Android's sample code "API Demos" application so that TextView items in the list of the default activity have the "content description" needed for accessibility. This is what the initialization looks like for the list in this activity:</p>
  
  <pre><code>public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      Intent intent = getIntent();
      String path = intent.getStringExtra("com.example.android.apis.Path");
  
      if (path == null) {
          path = "";
      }
  
      setListAdapter(new SimpleAdapter(this, getData(path),
              android.R.layout.simple_list_item_1, new String[] { "title" },
              new int[] { android.R.id.text1 }));
      getListView().setTextFilterEnabled(true);
  }
  </code></pre>
  
  <p>And the <code>getData</code> function creates a Map with the appropriate intentions specified for when someone taps on one of the TextView list elements. Internally, it uses this function:</p>
  
  <pre><code>protected void addItem(List&lt;Map&lt;String, Object&gt;&gt; data, String name, Intent intent) {
      Map&lt;String, Object&gt; temp = new HashMap&lt;String, Object&gt;();
      temp.put("title", name);
      temp.put("intent", intent);
      data.add(temp);
  }
  </code></pre>
  
  <p>This is how the Map is populated with <code>title</code>, which as you can see above is mapped to <code>@android/text1</code> in the layout XML.</p>
  
  <p>I want to set the content description of each of the TextViews with the same value as <code>name</code>. Things I've tried:</p>
  
  <p>(1): Looping through child items of the ListView that is generated and calling <code>item.setContentDescription(xxx)</code> on each of them. This didn't work; apparently at the point I'm looping through the items they're not visible/accessible/existent and either way trying to call setContentDescription blows up.</p>
  
  <p>(2): Creating a new layout XML for this modified TextView, that includes <code>android:contentDescription</code>. The layout XML looked like this</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;TextView xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@android:id/text1" 
      android:contentDescription="@android:id/text2"
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:textAppearance="?android:attr/textAppearanceLarge" 
      android:gravity="center_vertical" 
      android:paddingLeft="6dip" 
      android:minHeight="?android:attr/listPreferredItemHeight"&gt;
  &lt;/TextView&gt;
  </code></pre>
  
  <p>I then made sure that "contentDescription" was added to the Map returned by <code>addItem</code>, and changed the initialization code to look like this:</p>
  
  <pre><code>    setListAdapter(new SimpleAdapter(this, getData(path),
              R.layout.simple_list_item_with_desc, new String[] { "title", "contentDescription" },
              new int[] { android.R.id.text1, android.R.id.text2 }));
  </code></pre>
  
  <p>In other words, I was trying to get "contentDescription" from my static data map to populate the field in the layout XML defined by <code>android.R.id.text2</code>.</p>
  
  <p>This also didn't work--no failure, but when I examine the list in uiautomatorviewer, no content description is available. It could be because I don't understand what <code>android.R.id.text2</code> means, other than being a placeholder for a value of some kind. I also tried <code>android.R.id.content</code> with the same result.</p>
  
  <p>So my question is, how do I set the contentDescription of these TextViews dynamically?</p>