-1

I am looking to pass an array of object from activity to activity in Android. I understand that the optimal way to do this is having your passed objects implement Parcelable or Serializable, as explained here.

However, if I am passing an array of these objects, will this still work, considering you are now passing an array of objects that implement those interfaces, rather than the object itself? If not, would I instead need to extend a class such as ArrayList and implement these interfaces, and pass that 'array' object instead?

Community
  • 1
  • 1
vontell
  • 342
  • 3
  • 17
  • what happens when you try to serialise array? – Juned Ahsan Jul 06 '15 at 23:24
  • After looking around some more, I found [this](http://www.jguru.com/faq/view.jsp?EID=34789), which leads me to believe that the array does not add any complication to the scenario. – vontell Jul 06 '15 at 23:27

1 Answers1

0

As I understand it, calling serialize on an array causes the array to recursively call serialize on its members. However, it appears there may be a bug affecting this in Android versions prior to 5.0.1 https://stackoverflow.com/a/28720450/1541763

It seems that parceling an array follows this logically, but that unmarhsalling is a little more complicated: https://stackoverflow.com/a/10781119/1541763

Community
  • 1
  • 1
TBridges42
  • 1,849
  • 1
  • 19
  • 29
  • Would this same concept apply to the Parcelable interface as well? – vontell Jul 06 '15 at 23:32
  • It seems that parceling an array follows this logically, but that unmarhsalling is a little more complicated: http://stackoverflow.com/a/10781119/1541763 – TBridges42 Jul 06 '15 at 23:36