从一个活动传递的ArrayList的意图另一 [英] Passing arraylist in intent from one activity to another

查看:101
本文介绍了从一个活动传递的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

这篇关于从一个活动传递的ArrayList的意图另一的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆