Type has to be specified in the diamond, otherwise you get an error as a result of animals: ArrayList not matching ArrayList animals = arguments.getSerializable(ARG_ANIMALS) as ArrayList Otherwise you'll just get a Serializable and not the class which you have serialized. List and MutableList has to be cast to Serializable (otherwise it shows an "incompatible types" error) args.putSerializable(ARG_ANIMALS, animals as Serializable) //This is to cast it to the appropriate form in order for it to be serialized properlyĬasting here is necessary no matter what. NOTE: casting to Serializable isn't necessary if it's an ArrayList (this means ArrayList - List and MutableList are affected differently).
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |