So I've recently completed this tutorial and it works great, but I'm a little stuck on reading the data from my database.
I'm now reading from the database file thanks to Orsol by using this tutorial but I'm looking now for a method I can call which will return me the values of a given field. Or at least a method that let's me execute SQL.
The closest I have is by calling this:
public List<String> SelectAll()
{
List<String> list = new ArrayList<String>();
Cursor cursor = myDataBase.rawQuery("SELECT * FROM androidtable", null);
if (cursor.moveToFirst())
{
do
{
list.add(cursor.getString(0));
}
while (cursor.moveToNext());
}
if (cursor != null && !cursor.isClosed())
{
cursor.close();
}
return list;
}
But this just throws a SQLiteException:
android.database.sqlite.SQLiteException: no such table: androidtable: , while compiling: SELECT * FROM androidtable
I do however know that I am loading the correct file (which does have this table), as if I change the directory path or database name, it will fire a run time error.
Can anyone help?
Thanks