0

I'm having trouble serializing a abstract superclass in Android, the superclass is in a different package than the subclass (I have several apps that inherit from a core project).

After a lot of searching not finding any real answers I have to ask is this even possible? Do I have to reference the superclass somwhere in the subclass package? All I found is that it inits with the empty constructor which isn't really helpful in this case.

It kinda defeats the purpose if I have to add the superclass to every project...

Hope you understand what I mean, it's been a long time since I did anything remotely complicated in Java before this project.

EDIT: I have to temporarily store the objects on the device (for up to a couple of days) before they are transfered to a web service, so in my understanding Parcelable is not usable.

Some basic code to try to clarify a bit:

In my core package:

package com.test.core;
public abstract class ClassBase implements Serializable {

    public List<Measurments> measurments; // never gets serialized by the subclass.

}

In my app package that references the core package:

package com.test.app1;
public class ClassName extends ClassBase implements Serializable
4

1 回答 1

0

Did you try to add a getter and a setter for your measurements property ? I think you must do it.

于 2013-05-28T08:58:25.517 回答