2016-12-06 30 views
0

我正在解决问题HashMap。我必须使用Parcelable将数据从一个片段传递到另一个片段。我怎样才能做到这一点?如何使用Parcelable with HashMap

+1

使用捆绑...它是一种地图 – Selvin

+1

正在寻找如何使一个HashMap Parcelable?! – Mitchapp

+0

你可以按照这个[链接](http://stackoverflow.com/questions/5566921/androidpassing-a-hash-map-between-activities)来得到你的答案。 –

回答

2

最好的办法是使用包装类,或者只是提交一个数据模型到HashMap中,所以你可以有一个List<ObjectToReplaceHashMap>您可以与putParcelableArrayListExtra(String name, ArrayList<? extends Parcelable> value)getParcelableArray(String key)

发见https://stackoverflow.com/a/5567917/4623782以获取更多信息