I have an array of Objects stored in "rootFile". I would like to read back the objects into another ArrayList. So far I tried this:
List<NoteCard> cardArray = new ArrayList<>();
try {
FileInputStream fis = openFileInput(rootFile);
ObjectInputStream ois = new ObjectInputStream(fis);
cardArray = (List<NoteCard>)ois.readObject();
ois.close();
fis.close();
} catch(FileNotFoundException e) {
e.printStackTrace();
} catch(IOException e) {
e.printStackTrace();
} catch(ClassNotFoundException e) {
e.printStackTrace();
}
Listinterface? In that case the answer below can correct your issue there, but mind that it is completely wrong in regard of serialization. The suggested changes wouldn't fix serialization issues.