HashMap으로는 readObject()에서 예외가 발생.

GetFieldID: unable to find field Ljava/util/HashMap;.loadFactor:F



ArrayList -> file -> ArrayList

<ref>




TextView tv = (TextView)findViewById(R.id.textView2);

try {

ArrayList al = new ArrayList();

al.add("one");

al.add("two");

al.add("three");

ObjectOutputStream os = new ObjectOutputStream(

new BufferedOutputStream(new FileOutputStream(

getFilesDir().getAbsolutePath()+"/a.ser")));


os.writeObject(al);

os.close();



File file = new File(getFilesDir().getAbsolutePath()+"/a.ser");

Log.e(null, "file exist? : "+ file.exists());

ObjectInputStream ois = new ObjectInputStream(

new BufferedInputStream(new FileInputStream(

getFilesDir().getAbsolutePath()+"/a.ser")));


ArrayList al2 = (ArrayList)ois.readObject();


ois.close();

tv.setText(al2.get(1) + " - " + al2.get(2) + " - " + al2.get(0));


} catch (Exception e) {

Log.e(null, e.toString());

}


Posted by tenn
,