Best alternative to prepared statement when using SELECT SQLite?

I am running this function:

public int getSubjectId(int level, String subject){
    SQLiteDatabase db = this.getWritableDatabase();
    Cursor subjectCursor = db.rawQuery("select * from " + SUBJECTS_TABLE_NAME + " where "+ SUBJECTS_COL_2 + " = " + subject + " and " + SUBJECTS_COL_3 + "="+level,null);
    ArrayList<Integer> mArrayList = new ArrayList<Integer>();
    for(subjectCursor.moveToFirst(); !subjectCursor.isAfterLast(); subjectCursor.moveToNext()) {
        mArrayList.add(subjectCursor.getInt(0));
    }
    return mArrayList.get(0);
}

in an attempt to return the id of the first item in the table where both column 2 and 3 match the function arguments. However when it does run I get an error message as the function is searching for a column with the name of the subject inputted and not the row containing that value.

I get the error:

Error Code : 1 (SQLITE_ERROR)
Caused By : SQL(query) error or missing database.
(no such column: Maths (code 1):

Normally I would fix this problem using a prepared statement, but I have read that they should not be used when you are trying to return a value, which in this case I am as I want to return the ArrayList. Perhaps I have misinterpreted and prepared statements are ok in this situation, but either way I would appreciate any help finding the best solution to the error I am getting.

Thanks

EDIT:

SQLiteDatabase db = this.getWritableDatabase();
    String sql = "select * from " + SUBJECTS_TABLE_NAME + " where "+ SUBJECTS_COL_2 + " =?" + " and " + SUBJECTS_COL_3 + "=? ";
    SQLiteStatement statement = db.compileStatement(sql);
    statement.bindString(1, subject);
    statement.bindString(2, level);

    Cursor subjectCursor = statement.???();