blakelee
06/13/2017, 7:13 PMCannot use 'ACT' as reified type parameter. Use a class instead.
code:
class myClass<ACT: Activity>(): AnkoComponent<Fragment> ....
....
floatingActionButton
....
.setOnClickListener {
startActivity<ACT>()
}
damian
06/13/2017, 9:12 PMACT
is an erased type parameter, but startActivity
requires a reified type parameter.
explanation of type erasure in Java (same applies to Kotlin): https://stackoverflow.com/a/313590/3677267
reified type parameters in inline functions: https://kotlinlang.org/docs/reference/inline-functions.html#reified-type-parameters
to solve your problem, you'll have to pass a Class<ACT>
to your class and use it as an argument to startActivity
blakelee
06/13/2017, 10:23 PMblakelee
06/13/2017, 10:37 PM