use of org.eyeseetea.malariacare.data.database.model.StringKey in project pictureapp by EyeSeeTea.
the class UpdateDB method updateStringKeys.
public static void updateStringKeys(Context context, boolean updateCSV) throws IOException {
if (updateCSV) {
FileCsvs fileCsvs = new FileCsvs();
fileCsvs.saveCsvFromAssetsToFile(PopulateDB.STRING_KEY_CSV);
}
List<StringKey> stringKeys = StringKey.getAllStringKeys();
CSVReader reader = new CSVReader(new InputStreamReader(context.openFileInput(PopulateDB.STRING_KEY_CSV)), PopulateDB.SEPARATOR, PopulateDB.QUOTECHAR);
String[] line;
int i = 0;
while ((line = reader.readNext()) != null) {
if (i < stringKeys.size()) {
PopulateRow.populateStringKey(line, stringKeys.get(i)).save();
} else {
PopulateRow.populateStringKey(line, null).insert();
}
i++;
}
}
Aggregations