将对象的ArrayList传递给片段

时间:2015-03-26 10:03:13

标签: android android-fragments serialization arraylist parcelable

我有ArrayList<DataChannels> dataChannelsArrayList = new ArrayList<>()

DataChannels.java

public class DataChannels {
    private DataRequestStatus dataRequestStatus;
    private ArrayList<Channel> channelArrayList;

...getters-setters...
}

Channel.java

class Channel{
   private String id;
   private String taxonomy_name;
   private String ch_id;
   private String lang;
   private String name;
   private String __v;
   private String sort;
   private boolean active;

...getters-setters...
}

DataRequestStatus.java

public class DataRequestStatus {
private String status;
private String error;

...getters-setters...

}

我无法理解如何将ArrayList<DataChannels> dataChannelsArrayList传递给Fragment来自Activity

我尝试过Serializeble界面。不工作。并且想尝试Parcelable但不知道如何正确实施writeToParcel(Parcel out, int flags)

请帮帮我。它真的很混乱。

0 个答案:

没有答案