title: Android LinearLayout populate children from database
body: <p>I have a HorizontalScollView. It has a LinearLayout child. How do I populate the linear layout with children created based on content from a database since I can't bind a SimpleCursorAdapter to it (obviously)?</p>
  
  <p>I've tried:</p>
  
  <pre><code>    SimpleCursorAdapter summaryItems = new SimpleCursorAdapter(this, R.layout.summary_item, summaryItemsCursor, from, to);
      int count  = summaryItems.getCount();
      View new_view;
      for (int i = 0; i &lt; count; i++) {
          new_view = (summaryItems.newView(this, summaryItemsCursor, mNewsContainer));
          mNewsContainer.addView(new_view);
      }
  </code></pre>
  
  <p>I was hoping that the view returned by the SimpleCursorAdapter.newView() would be usable, but apparently not.  I'm quite new to android and completely lost as to the right way to do this.</p>
  
  <p>XML's for reference:</p>
  
  <pre><code>&lt;HorizontalScrollView android:id="@+id/news_gallery"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"&gt;
          &lt;LinearLayout android:id="@+id/news_container"
              android:orientation="horizontal"
              android:layout_height="wrap_content"
              android:layout_width="wrap_content"
              &gt;
          &lt;/LinearLayout&gt;
  &lt;/HorizontalScrollView&gt;
  </code></pre>
  
  <p>and summary_item</p>
  
  <pre><code>&lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/news_gallery_item"
      android:layout_marginRight="@dimen/news_gallery_item_spacing"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"&gt;
      &lt;ImageView android:id="@+id/news_gallery_item_image"
          android:adjustViewBounds="true"
          android:maxHeight="@dimen/news_gallery_image_height"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"/&gt;
      &lt;TextView android:id="@+id/news_gallery_item_tagline"
      style="@style/news_gallery_text_container"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"/&gt;
  &lt;/FrameLayout&gt;
  </code></pre>