I've a problem with parceling an enum type via an intent, problem is with this line. intent.getParcelableArrayListExtra
and the error is
not enough information to infer information for type variable T
override fun onCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) {
super.onCreate(savedInstanceState, persistentState)
setContentView(R.layout.main_activity)
if (savedInstanceState == null)
(fragment as DataFragment).setData(intent.getParcelableArrayListExtra(Application.BUNDLE_DATA) as ArrayList<DataEnum>)
}
Enum
@Parcelize
enum class DataEnum : Parcelable {
Foo { override fun toString() = "Foo" },
Bar { override fun toString() = "Bar" },
Baz { override fun toString() = "Baz" };
companion object {
private fun list(): ArrayList<DataEnum> {
return arrayListOf(
FOO,
BAR,
BAZ
)
}
}
}