问题
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