Serializable ArrayList of Overlays

Put problem concerning MapActivities, MapViews, Overlays and GPS in this forum.

Serializable ArrayList of Overlays

Postby YellowJK » Tue Aug 31, 2010 3:20 pm

Hello, i been having a some what unique problem...

I have created a Serializable ArrayList<E> class that extends ArrayList<E> and implements Serializable. This class works flawlessly when saving and loading ArrayList<String>.

Now i am trying to save and reload a SerializableArrayList<Overlay>.

at first i couldn't save the SerializableArrayList<Overlay> because GeoPoint is not Serializable. so i created a SerializableGeoPoint class the extends GeoPoint and implements Serializable.

using SerializableArrayList<Overlay> and SerializableGeoPoint i can save to a file, but i can not load the SerializableArrayList<Overlay>.

When i try to load from the saved file, i get the following error.

Code: Select all
08-30 20:26:36.254: WARN/System.err(4087): java.io.InvalidClassException: com.google.android.maps.GeoPoint; IllegalAccessException


i have tryed creating a no arg constructor for SerializableGeoPoint and making sure that both Serializable classes have the same serialVersionUID.

Thank you for your time, i hope to fix this soon :(
YellowJK
Freshman
Freshman
 
Posts: 9
Joined: Fri Apr 09, 2010 12:19 am

Top

Re: Serializable ArrayList of Overlays

Postby prongs_386 » Wed Sep 15, 2010 2:43 pm

When you are creating the overlays I assume you have overlay items with a SerializableGeoPoint as a location? Well for saving that will be fine, but when you load the file the overlay will be constructing a GeoPoint object not your serializableGeoPoint object. That is why I believe you get the invalidClassException.

I don't think your going to have much luck trying to serialize that Overlay.. instead I would convert it into some other representation and serialize that instead.

Maybe posting the code for writeObject and readObject would help?
prongs_386
Freshman
Freshman
 
Posts: 7
Joined: Mon Sep 13, 2010 3:27 am

Top

Return to Map Problems

Who is online

Users browsing this forum: No registered users and 1 guest