Я сохраняю свой ArrayList в SQLite. Сохранить коды:
public void HistoryADD(ArrayList<String> full, String owner){
int size = full.size();
SQLiteDatabase db = getWritableDatabase();
try{
for (int i = 0; i < size ; i++){
ContentValues cv = new ContentValues();
cv.put(FULL, full.get(i));
cv.put(OWNER, owner);
db.insert(TABLE_NAME, null, cv);
}
System.out.println("added:" + full);
db.close();
}catch (Exception e){
System.out.println("Failed to add" + full);
}
}
И ЭТО работает. Я хочу получить этот ArrayLists из SQLite. Список кодов:
public ArrayList<String> History_list(String owner) {
SQLiteDatabase db = this.getReadableDatabase();
ArrayList<String> history_list = new ArrayList<>();
Cursor cursor = db.rawQuery("SELECT * from " + TABLE_NAME + " WHERE owner='"+owner+"'",
new String[] {});
cursor.close();
return history_list;
}
Но код списка не работает. Что не так в этих кодах?
Спасибо.