I have objects that I transfer between activations. Faced a problem. I have an object from either, I make a proxy class for it from Serializable. Intent is thrown normally, but in the new activation it is empty. Can anyone have any guesses? Before the question I found and read How to serialize an object that does not implement any of the serialization interfaces? , I did it from the very beginning, but cheto does not work =)

    3 answers 3

    @Gorets - you're an experienced guy, but you’re talking neponyatki.

    In Android, the only way (apart from of course global variables and so on) to communicate between the Activity is the Parcel / Parcelable .

    There is no curvature or dampness - everything works fine. Maybe you have some kind of misunderstanding how it works.

    In your particular case use Bundle.putSerializable()

     Bundle bundle=new Bundle(); bundle.putSerializable("MY_OBJECT", myObject); 
    • "This whole Parceable functionality looks unfinished (read: has bad design)." somewhere from the stack, on some forum I have already discussed its implementation and came, almost, to the same conclusion. Well, the usual object serialization and their transfer via the intent also works. - Gorets

    To correctly transfer an object between an Activity, you need to implement the Parcelable interface in its class. Serializable in Android is also supported, but in the first case fewer improvements are needed in the classroom and with performance should be better. This article is a good example of the transfer of objects between the Activity.

      There seems to be a parcelable and not serializable.

      • I know, IMHO with parcelable to play more and it is raw, and serializable works well - Gorets