Travis Griggs
09/11/2023, 10:38 PMitems(items = sortedPlans, key = { plan -> plan.oid })
oid is just a UInt. However, this fails. Digging through Logcat, I find this gem:
java.lang.IllegalArgumentException: Type of the key 2 is not supported. On Android you can only use types which can be stored inside the Bundle.
Going back and looking at what I was doing before, I actually had a Pair there. So I just changed the above code to first:
items(items = sortedPlans, key = { plan -> 'p' to plan.oid })
and that worked!?! As did this:
items(items = sortedPlans, key = { plan -> plan.oid.toInt() })
What strange magic is this? I can't use a UInt? But I can if I wrap it in a pair? Why would that be the case?ephemient
09/11/2023, 10:56 PMkotlin.Pair
implements java.io.Serializable
on JVM, which makes it pass the saveable testephemient
09/11/2023, 10:58 PMUInt
wrapper class isn't serializable, but the generic Pair class can't know thatTravis Griggs
09/11/2023, 11:17 PMephemient
09/11/2023, 11:20 PMTravis Griggs
09/11/2023, 11:41 PM