1

I created a custom Preference RangeBarPreference. I must have initially persisted the preference value as an Integer as I'm getting this error message:

java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String

when trying to perform persistString("text").

persistString() works fine when I change my preference key from age_range to something different:

<app.meeq.RangeBarPreference
    android:key="minmax_age"
    android:title="Age Range"
    android:layout="@layout/preference_rangebar"/>

but I would like to use the initial key age_range, even though it's saved as an Int/Integer.

How can I delete the age_range Preference value so I can use persistString() on it?

Zorgan
  • 8,227
  • 23
  • 106
  • 207
  • uninstall your app to clear the keys if the problem is change the key to another type. but if you want to have same key for different type at runtime then check out this answer https://stackoverflow.com/questions/5533078/timepicker-in-preferencescreen?answertab=votes#tab-top – Alireza Sharifi Jun 15 '19 at 04:14
  • I did uninstall and reinstall but the key is still there unfortunately – Zorgan Jun 15 '19 at 04:34
  • try it on other device or emulator just make sure of the problem. – Alireza Sharifi Jun 15 '19 at 04:37

0 Answers0