Do not use string concatenation to assemble a SQL query this way. You are not properly quoting your value, let alone handle any quotes in the value itself.

Replace queries like:

String query = "SELECT * FROM " + TABLE_SCORES + " WHERE " + KEY_TITLE + " = " + title;
Log.e(DatabaseHelper.class.getName(), query);
Cursor c = db.rawQuery(query,null); //GETTING ERROR HERE

with:

 

String query = "SELECT * FROM " + TABLE_SCORES + " WHERE " + KEY_TITLE + " = ?";
Log.e(DatabaseHelper.class.getName(), query);
Cursor c = db.rawQuery(query, new String[] { title });

 

The ? tells SQLite to bind the supplied argument, handling quoting, escaping of embedded quotes, and so on.

+ Recent posts