Android abstract arraylist parcelable

这一生的挚爱 提交于 2019-12-24 09:14:59

问题


I have an arraylist of abstract objects(animals) and I'm trying to send and restore this array. The problem is that I need to give a creator when rebuilding the array, at this moment I'm passing a string that I check in the Animal creator and check what kind of animal I need to create.

I don't thing this is the most effective, so is there a better way to create a parcelable abstract array?

Here is a little demo project that describes the problem.

https://github.com/Evertvandenbruel/parcelable-abstract/tree/master/Parcelable-example/src/com/example/parcelable_example/model

Or is there an better to get the type of a parcelable object?

来源:https://stackoverflow.com/questions/12626320/android-abstract-arraylist-parcelable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!