问题
I used SQLite and in my project it works well if the device language is in English. However if I change the device language I get an error which is;
java.lang.IllegalArgumentException: the bind value at index 1 is null
....
com.radioapps.radiostations2020.models.DatabaseHelper.getRadioNamesByCountryName(DatabaseHelper.java:127)
line 127 is;
Cursor c = myDataBase.rawQuery(query, new String[]{string});
and the whole method is;
public List<String> getRadioNamesByCountryName(String string) {
List<String> list = new ArrayList<>();
myDataBase = this.getWritableDatabase();
String query = "SELECT name FROM second WHERE country=?";
Cursor c = myDataBase.rawQuery(query, new String[]{string});
while (c.moveToNext()) {
list.add(c.getString(c.getColumnIndex("name")));
}
c.close();
return list;
}
来源:https://stackoverflow.com/questions/60964966/when-i-changed-the-device-language-app-crashes