Reputation: 7577
I have a SQLite database in my Android project and need to get the latest row in a table. I'm doing it this way:
Cursor cursor = db.rawQuery("SELECT MAX(" + KEY_ROU_ID + ") FROM " + DATABASE_TABLE_ROU + ";", null, null);
However, this requires API level 16. Is there a way to do this that works with API level 14? E.g SQLiteDatabase.query()?
Upvotes: 0
Views: 263
Reputation: 16796
The main overload of SQLiteDatabase.rawQuery
, which takes a string and an array of strings, exists as of API Level 1.
You are accidentally another overload, that only exists from API Level 16, and takes a cancellation token.
Just remove the last argument from your call.
Upvotes: 2
Reputation: 665
Check the SQLite documentation to make sure you're using it right. I tried using 2.2 and it worked fine for me.
Upvotes: -1