My Cursor is always -1 when i send a request to my database (sqlite) to load an image.
public Cursor getData(int id){
SQLiteDatabase db = this.getWritableDatabase();
String query = "SELECT * FROM " + TABLE_NAME + " WHERE ID = " + id;
Log.d(TAG, query);
Cursor data = db.rawQuery(query, null);
return data;
}
The result is an app crash and this log in the logcat:
FATAL EXCEPTION: main Process: com.master.tobias.phono, PID: 10721 android.database.CursorIndexOutOfBoundsException: Index -1 requested, with a size of 1
Edit: The query works fine with the DB Browser for SQLite.