[Solved] Android cursor out of bounds exception


Replace your below code

        cursor.moveToFirst();
        Note newNote=cursorToNote(cursor);
        cursor.close();
        return  newNote;

With

    if (cursor != null && cursor.moveToFirst()) {
            Note newNote=cursorToNote(cursor);
            cursor.close();
            return  newNote;
    } 
    else {
        return null;
    }

4

solved Android cursor out of bounds exception