Hi!
Im trying to program with database in Android. So far i have made the database and written to it.
The problem: When i try to read the data back from the database the program "stoped unexpectedly". I have tested to find what cause the crash and has found that it's this line:
Cursor c = db.getAllTitles();
But i dont understand why it cause the crash... Can anyone help?
Here's the code to start getting the data:
public void GetAll()
{
DBAdapter db = new DBAdapter(this);
db.open();
Cursor c = db.getAllTitles();
if (c.moveToFirst())
{
do {
DisplayTitle(c);
} while (c.moveToNext());
}
db.close();
}
And this is from the Database helper class:
public Cursor getAllTitles()
{
return db.query(DATABASE_TABLE, new String[] {
KEY_ROWID,
KEY_TITLE,
KEY_DATE,
KEY_EXTRA},
null,
null,
null,
null,
null);
}