FAZ
FAZ

Reputation: 285

Android how to serialize data and write to a text file

I have a ArrayList of my customized type. If i convert to String and write to a file and my other code reads the file as a String I dont know how to convert the read String back to my customized type.

I am planning to serialize this custom ArrayList and write to a file. Later for reading, deserialize it and read it as my custom ArrayList.

How do I achieve this? Any code would help me.

Upvotes: 0

Views: 96

Answers (1)

Eric B.
Eric B.

Reputation: 4702

You can use the ObjectOutputStream and ObjectInputStream classes for this. See this tutorial.

Upvotes: 1

Related Questions