Hi!
I am just starting out with Android and I am attempting my first test app, but I am a bit stuck.
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.
My layout xml is as follows:
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:orientation="vertical"
 android:layout_width="fill_parent" 
 android:layout_height="fill_parent">
  <Gallery
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/Weeksgallery"    
      android:layout_width="fill_parent"   
      android:layout_height="wrap_content"/>
 <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" />
 </LinearLayout>
I want the gallery with a button below
My on create function I have the following:
    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();
 }
I am using the notepad tutorial as an example and my class extends ListActivity.
When I run it I get the error
Your content must have a ListView whose id attribute is 'android.R.id.list'
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)
Can anyone help?
Thanks
Bex