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.
'기타 ETC > Android Studio' 카테고리의 다른 글
주간 달력 만들기 (0) | 2020.10.11 |
---|---|
안드로이드 TTS(TextToSpeech) 음성출력 사용하기 (0) | 2020.07.22 |
COVID19 TRACKER Android source code (0) | 2020.07.14 |
안드로이드 뮤직플레이어 소스코드 (0) | 2020.07.13 |
[Android] Delay handling using postDelayed method (0) | 2020.07.08 |