Android Binding from SQLite to Gallery
<p>I am just starting out with Android and I am attempting my first test app, but I am a bit stuck.</p>

<p>I have an SQLite database and a user is selecting a picture and a reference to this a long with a short description is getting stored in the database.
This is all working fine, now I want to bind the images from to database to a gallery, but I am a bit confused how I do this.</p>

<p>My layout xml is as follows:</p>

<pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt;
 &lt;LinearLayout
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:orientation="vertical"
 android:layout_width="fill_parent" 
 android:layout_height="fill_parent"&gt;

  &lt;Gallery
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/Weeksgallery"    
      android:layout_width="fill_parent"   
      android:layout_height="wrap_content"/&gt;

 &lt;Button android:id="@+id/ok"     
       android:layout_width="wrap_content"   
       android:layout_height="wrap_content"
       android:layout_below="@+id/text1"    
       android:layout_marginLeft="10dip"    
       android:text="Take a Picture"   
       android:onClick="TakePicture" /&gt;
 &lt;/LinearLayout&gt;
</code></pre>

<p>I want the gallery with a button below</p>

<p>My on create function I have the following:</p>

<pre><code>    public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);

  mDbHelper = new DbAdapter(this);
  mDbHelper.open();
  Cursor cur = mDbHelper.fetchDaysImages();

  //array of fields to display
  String[] from = new String[] { mDbHelper.KEY_ROWID,mDbHelper.KEY_PICREF};

  int[] to = new int[] { R.id.Weeksgallery };

  // Now create a simple cursor adapter and set it to display
  SimpleCursorAdapter images = new SimpleCursorAdapter(this,
    R.layout.main, cur, from, to);
  setListAdapter(images);

  mDbHelper.close();
 }
</code></pre>

<p>I am using the notepad tutorial as an example and my class extends ListActivity.</p>

<p>When I run it I get the error</p>

<blockquote>
  <p>Your content must have a ListView whose id attribute is 'android.R.id.list'</p>
</blockquote>

<p>I'm assuming I am using the wrong type of binding, but I can't seem to find anywhere that tells me how to bind from an sqlite DB to a gallery. 
I also want to add a reference to the rowId in the gallery so when the image is clicked it will open the relevant page (so it can show the message)</p>

<p>Can anyone help?</p>

<p>Thanks</p>

<p>Bex</p>
