[Solved] Does the Activity need to be Serializable when sending a class that implements Serializable through Intent and putExtra?


Does i.putExtra(String name, Serializable s) require the Activity where the Intent is sent from to implement Serializable?

No, but it does mean that s cannot refer to the activity or other non-Serializable stuff or you will need to take steps to prevent the serialization from trying to serialize them (e.g., override the methods described in the documentation).

it is triggered on objects in the NewGame class, which does not have an instance in gh

Yes, it does. It is right here:

private Context c;

First, Context is not Serializable. Second, Activity inherits from Context, and c is your NewGame activity, because you assign that to c.

8

solved Does the Activity need to be Serializable when sending a class that implements Serializable through Intent and putExtra?