从一个活动传递的ArrayList的意图另一

问题描述:

我有一类产品和我需要传递的产品对象的数组列表从一个活动到另一个。 我读,我可以通过我的产品类Parcelable和使用这样:putParcelableArrayListExtra(字符串名称,ArrayList的值)

I have a class 'Product' and i need to pass the arraylist of 'Product' objects from one activity to another. I read that i can do so by making my Product class as Parcelable and use : putParcelableArrayListExtra (String name, ArrayList value).

在我的应用程序,我需要从一个活动传递对象的ArrayList到另一个。在这种情况下,我需要让所有的类作为parcelable和实现接口的方法。 这是解决问题的正确方法是什么?有没有送的意图对象列表中任何其他方式?

In my app, i need to pass arraylists of objects from one activity to another. In this case, i need to make all those classes as parcelable and implement the interface methods. Is this the correct way to solve the problem? Is there any other way to send the list of objects in intents?

谢谢..

是的,正确的方法是使用 Parcelable 或做序列化到另一种原始的对象是你可以把到意图的额外

Yes, the correct way is to use Parcelable or do the serialization to another kind of primitive object that you can put to Intent's extras