In a piece of code I've written, I have this line:
AllSprites = (ArrayList<ClSprite>) savedInstanceState.getParcelableArrayList("AllSprites");
I'm getting an error about an invalid cast from an ArrayList<Parcelable>
to ArrayList<ClSprite>
. Why isn't this legal?
A simple solution is to set the returning element type like so
ArrayList<ClSprite> AllSprites = savedInstanceState.<ClSprite>getParcelableArrayList("AllSprites")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With