Hi, I'm having a problem, and I do not know how to send an object to another activity. They told me that I could through the putExtras (), of the intent. But I could not
To transfer objects in a Bundle
you have to do three things:
Serializable
putSerializable(String key, Serializable objeto)
to set it to Bundle
getSerializable(String key)
to get it from Bundle
in your activity To implement Serializable
you do not have to do anything other than add implements Serializable
to the class definition (the typical objects that one uses for the majority already implement it).
When you extract the object from Bundle
you have to cast, with or without checking with instanceof
first.
MiObjeto objeto = (MiObjeto) bundle.getSerializable("mi_objeto");