简体   繁体   中英

Putting ArrayList of ArrayList into a bundle, parcelable

Hi i need to put an ArrayList < ArrayList< String>> in my class yet retain its parcebility

private ArrayList<ArrayList<String>> quotes;

I have tried

bundle.putParcelableArrayList(QUOTE_ARRAY, quotes);

i get 'quotes' underlined in red and it says "required: java.util.ArrayList< ?extends android.os.Parcel able>"

how can i make the ArrayList inside the parent ArrayList parcelable

Since an ArrayList is not a parcelable, I would suggest encapsulating the ArrayList of strings in an class that implements parcelable. Then just use an ArrayList containing that object type.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM