java - Android ObjectInputStream readObject throws IllegalAccessException -
i trying write serialized object in onpause method file can read again file when start app time , need previous data.
this save object
try { fileoutputstream fout = openfileoutput(logfilename, mode_private); objectoutputstream fw = new objectoutputstream(fout); fw.writeobject(obj); log.d("obj", "added"); fw.close(); } catch (exception e) { log.d("obj", "not added"); e.printstacktrace(); } return;
i can see "added" message , means object has been saved in file.
here try read saved object:
try { fileinputstream fin = openfileinput(logfilename); objectinputstream fread = new objectinputstream(fin); object res = fread.readobject(); log.d("obj", "readed successfully"); } catch (exception e) { e.printstacktrace(); }
and :
java.io.invalidclassexception: android.view.view; illegalaccessexception
on line calling "fread.readobject()". thank if please tell me why throwing following exception. in advance.
Comments
Post a Comment