Im having some troubles trying to get the info stored in my database and showing it in a ListView.
This is the ListActivity where i want to show the rows:
Right, you should create the database table before querying on it.
Here is an example:
private static final String DATABASE_CREATE_DRIVERS =
"create table " + DATABASE_TABLE_DRIVERS + "(" + KEY_ROWID +" integer primary key autoincrement, "
+ KEY_DRIVERID + " text not null,"
+ KEY_FIRST_NAME + " text not null,"
+ KEY_LAST_NAME + " text not null,"
+ KEY_SPEED_LIMIT + " int not null,"
+ KEY_TIMESTAMP + " int"
+ ");";
Then query on it here:
public Cursor fetchAllDrivers(){
Cursor mCursor =
mDb.query(true, DATABASE_TABLE_DRIVERS, new String[] {
KEY_ROWID,
KEY_DRIVERID,
KEY_FIRST_NAME,
KEY_LAST_NAME,
KEY_SPEED_LIMIT,
KEY_TIMESTAMP},"", null,null, null, null, null);
if (mCursor != null) {
mCursor.moveToFirst();
}
return mCursor;
}
It also appears that you are missing a sixth argument as to what you are querying for. See where I put "" in method parameter string.