简体   繁体   English

将数组意图从一个活动传递到另一个活动

[英]Passing arraylist in intent from one activity to another

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). 我读到我可以通过将我的Product类设置为Parcelable并使用:putParcelableArrayListExtra(字符串名称,ArrayList值)来做到这一点。

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? 还有其他方法可以发送意图中的对象列表吗?

Thanks.. 谢谢..

是的,正确的方法是使用Parcelable或对可以放入Intent的附加对象的另一种原始对象进行序列化

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 传递一个 ArrayList<Object> 从一个意图到另一个意图 - Passing an ArrayList<Object> from one Intent to another 使用意图将数组列表从一个活动传递到另一个活动时,未经检查的强制转换错误 - Unchecked Cast error while passing an arraylist from one activity to another using intent 将ArrayList从一个活动传递到另一个活动时遇到问题 - Problem Passing ArrayList from one Activity to Another 将arraylist从一个活动传递到另一个活动的片段 - Passing arraylist from one activity to fragment of another Android:将意图的BasicNameValuePairs的ArrayList传递给另一个Activity - Android:Passing ArrayList of BasicNameValuePairs with intent to another Activity 将数据从一个活动中的两个不同意图传递到另一个活动 - Passing data from two different intent in one activity to another activity 将对象(包含arraylist)从一个活动传递到另一个活动 - passing object (which contains arraylist ) from one activity to another activity 使用意图将价值从一项活动传递到另一项活动 - Passing value from one activity to another using intent Android-将对象的意图从一个活动传递到另一个活动(崩溃) - Android - Passing intent with object from one activity to another (crashing) 在这个程序中将ArrayList从一个活动传递到另一个活动不起作用 - in this program passing ArrayList from one activity to another not working
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM