In my app I want to put in an array some items from database. I can see them, as a list using this function :
private void fillData()
{
c = db.fetchListId(listid);
startManagingCursor(c);
adapter = new SimpleCursorAdapter(this, R.layout.listproduct, c,
new String[] { DbAdapter.KEY_ITEM,
DbAdapter.KEY_QUANTITY,
DbAdapter.KEY_UNITS },
new int[] { R.id.prod1,
R.id.prod2,
R.id.prod3 }
);
setListAdapter(adapter);
}
But I don’t know how can I put them in an array.
Can anyone help me, please?
You’re definitely going to begin by iterating through the cursor:
Without knowing more about how you want to store the data, it’s impossible to guess what you need beyond
c.moveToNext().UPDATE:
OK, so you just want to accumulate them into a String. Try something like: