회사는 정말 싫어욧


TextView textView;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

textView = findViewById(R.id.tv);

try { //파일저장
Serializer serializer = new Persister();
Person person = new Person(1,"한사람",22,true);
OutputStream os = openFileOutput("person.xml",MODE_PRIVATE);
serializer.write(person,os);
os.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}


try { //파일읽기
Serializer serializer = new Persister();
InputStream is = openFileInput("person.xml");

Person person = serializer.read(Person.class, is);

textView.setText(person.toString());


} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}



}
}