kotlin - 如何在 Kotlin 中放置和获取要捆绑的字符串列表
问题描述
假设有字符串列表,如
val list = listOf("a", "b")
如何将它保存到 Kotlin 的 Bundle 中并从中获取?
我试过这样保存,但它给出了类型不匹配错误
outState.putStringArrayList(KEY, list.toTypedArray())
Type inference failed. Expected type mismatch
Required: ArrayList<String!>?
Found: Array<String>
解决方案
推荐阅读
- can-bus - 如何在 canalyzer 中播放或打开 .blf 文件?
- java - 我的 NavigationView 不会显示在 Android Studio 的 DrawerLayout 中
- telerik - Telerik 的 Rad Grid 编辑模式切换
- java - org.springframework.beans.factory.UnsatisfiedDependencyException:创建名为“controllery”的bean时出错
- python - 索引空数组,Numba 与 Numpy
- javascript - 将 aria 用于可扩展项目
- c++ - 错误'class HotelRoom'没有名为'menu'的成员,即使它在那里
- iis - 经典 ASP 页面调用批处理脚本
- java - javafx android中的文本字段和组合框问题
- c# - 如何访问 C# 中的第一个基类?