A very simple piece of code that returns me sometimes a ClassCastException. There is nowhere in my code a place where I have saved Long into this property.
Fatal Exception: java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer
at android.app.SharedPreferencesImpl.getInt(SharedPreferencesImpl.java:307)
Maybe someone has an idea why does it happen?
var numberOfRepayment
get() = sharedPrefs.getInt(UserSetting.NUMBER_OF_REPAYMENT.value, 0)
set(value) {
editor.run { putInt(UserSetting.NUMBER_OF_REPAYMENT.value, value).apply() }
}
I have never personally met this issue but see it through Crashlytics