I´m currently working with SQLite databases on android. i have a simple database with 4 columns (id, c1, c2, c3)
i have a methode that returns the last entry of a specific column. I don´t know the id of the entry, but i know its always the most recent one.
currently i´m doing it like this:
public int Select(String column){
Log.i(TAG, column +" request");
SQLiteDatabase db = this.getReadableDatabase();
Cursor cs = db.query(table, new String[]{column,null,null,null},null,null,null,null,null);
if(cs!=null && cs.moveToFirst()){
cs.moveToLast();
return Integer.parseInt(cs.getString(cs.getColumnIndex(column)));
}
}
at runtime, cs is always null and i can´t figure out why. What am I doing wrong?
thanks in advance