I got a property, persisted in shared prferences.
there are 2 places refer to it in entire code:
firstRunTimestamp = wmbPreference.getLong(ApplicationData.ParametersInternals.FIRST_RUN_DATE, 0);
editor.putLong(ApplicationData.ParametersInternals.FIRST_RUN_DATE, new Date().getTime());
In my logs I found this exception
"java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Long at android.app.SharedPreferencesImpl.getLong("
And the stack indicates this code is inside the method that access this property,
Can anyone explaing how it is even possible?
SharedPreferencestores all the data in the form of key value pairs. Both key and values being string. (This is not true if you explicitly store values to the SharedPreference as Long. Check my reply to below.)You need to parse the Long value from your string as