I have a problem and I have no idea whats wrong. I have a database
called items and it consists of the following fields: _id integer,
list integer, category integer, item text.
In my program I have a function called getItems:
public Cursor getItems()
{
return db.query(items, new String[] {item}, null, null,
null, null, null);
}
Then I have the fillItems function in another class
private void fillItems()
{
Cursor c = db.getItems();
startManagingCursor(c);
String[] from = new String[] { item };
int[] to = new int[] { R.id.shoppingitem };
SimpleCursorAdapter cItems = new SimpleCursorAdapter(this,
R.layout.item, c, from, to);
setListAdapter(cItems);
}
And this fails!
I then created a debugging routine:
private void fillItems()
{
Cursor c = db.getItems();
c.moveToFirst();
String s = c.getString(0);
c.close();
Toast.makeText(this, s.toString(), Toast.LENGTH_SHORT).show();
}
I am at a complete loss, any attempt to read any data fails, but yet a
call to c.count returns the right number of records from the database.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---