In my Android app, I had a TreeMap
that I could happily add to the Bundle
, for example
bundle.putSerializable("myHappyKey", myHappyTreeMap);
but now when I port my application to Kotlin, Android Studio complains that Serializable!
is required Serializable!
but instead he finds Map
.
How can I handle this?
EDIT The warning seems to disappear if I drop the card on Serializable
. Is it so?
EDIT 2 I declare and initialize myHappyTreeMap
as
var myHappyTreeMap: Map<Int, Double> = mapOf()
The documentation says that maps initialized with mapOf()
are serializable. If the documents say so ...
source share