Вы можете прочитать простой файл с SD-карты с 1 оператором вставки на строку и выполнить итерацию по этому файлу.
Вот аналогичный пример, в котором я читаю файл и добавляю ContactItem в мой contact_list:
public ArrayList<ContactItem> readInputFile(Context context, String filename) {
String text = null;
BufferedReader reader = null;
ArrayList<ContactItem> contact_list = new ArrayList<ContactItem>();
contact_list.clear(); // Clear any existing contacts when a new file is read
try {
reader = new BufferedReader(new FileReader(filename));
// Repeat until EOF
while (((text = reader.readLine()) != null)) {
if (!(text.length() > 1024)) { // If we read more than 1k per line there's a problem with the input file format
ContactItem c = new ContactItem(text);
if (c.getIsValid()) {
// We were able to parse a well formed phone number from the last line read
contact_list.add(c);
}
}
}
} catch (FileNotFoundException e) {
Toast.makeText(context, R.string.error_fileNotFound, 1).show();
e.printStackTrace();
} catch (IOException e) {
Toast.makeText(context, R.string.error_ioException, 1).show();
e.printStackTrace();
} finally { // EOFException (or other, but EOF is handled and most likely)
try {
if (reader != null) {
reader.close();
}
} catch (IOException e) {
Toast.makeText(context, R.string.error_generalFailure, 1).show();
e.printStackTrace();
}
}
return contact_list;
}