trbnb / MvvmBase

Apache License 2.0
15 stars 7 forks source link

Runtime Crash when using abstract activities #9

Closed apm-christian-dziuba closed 6 years ago

apm-christian-dziuba commented 6 years ago

Got the following crash:

Caused by: java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType at de.trbnb.mvvmbase.MvvmBindingActivity.getViewModelClass(MvvmBindingActivity.kt:87) at de.trbnb.mvvmbase.MvvmBindingActivity.onCreate(MvvmBindingActivity.kt:119) at de.intech.main.gui.overview.OverviewActivity.onCreate(OverviewActivity.kt:52)

OverviewActivity is an abstract activity class. Got two activity classes inheriting from this overview activity class. They both use the same ViewModel class that is provided inside the OverviewActivity. The shared ViewModel class has one constructor parameter. But removing this, was not preventing the error.

trbnb commented 6 years ago

That was a silly mistake by me. I released a fix with version 1.1.1.