3

Hey all my fellow geeks out there!

I need to save objects from my Android app to the SD card. I have searched a lot about this in google, but I dont seem to find anything. I only find how to save primitive types, but not entire objects with all its related attributes.

What I have is:

Dog dog = new Dog();
dog.setBirthYear(2009);
dog.setName("Pluto");

I need to save this Dog-object to the SD card and retrieve it when needed, with all the related attributes.

I would be very happy if code samples for saving and retrieving the object could be provided.

Thank you very much in advance!

ACetin
  • 97
  • 7

2 Answers2

1

With ObjectOutputStream you can serialize objects in files.

yDelouis
  • 2,094
  • 17
  • 18
1

See links below, these are related to your problem

Some object don't save to Android internal memory

How to store a class object into Internal Memory Storage using serializable?

Storage Options

Community
  • 1
  • 1
Androider
  • 2,884
  • 5
  • 28
  • 47