在包中传递ArrayList

时间:2014-07-29 15:17:08

标签: android arraylist bundle

我怎么能把一个arraylist捆绑在一起?我用过这个,但这是错的:

   Bundle bundTemasSel = new Bundle();
   ArrayList<TemaRescatado> arraydirGen = dataAdapter.temaGenList;
   bundTemasSel.putParcelableArray("arraySel", arraydirGen);

对象TemaRescatado有以下代码:

  public class TemaRescatado {

    protected String tema;
    protected long id;
    protected Boolean selected = false;

    ...


}

1 个答案:

答案 0 :(得分:1)

TemaRescatado必须实施Parcelable才能putParcelableArray所以您需要:

public class TemaRescatado implements Parcelable {
    // variables
    // Parcelable methods
}