Error while save preferences data #772

Closed
mehdifanai opened this Issue Jan 26, 2014 · 1 comment

Comments

Projects
None yet
2 participants

When i run the following peace of code:

        public static void clearSwSharedPref(SharedPreferences prefs) {
        SharedPreferences.Editor editor = prefs.edit();
        editor.remove(Stopwatches.PREF_START_TIME);
        editor.remove(Stopwatches.PREF_ACCUM_TIME);
        editor.remove(Stopwatches.PREF_STATE);
        int lapNum = prefs.getInt(Stopwatches.PREF_LAP_NUM,
                Stopwatches.STOPWATCH_RESET);
        for (int i = 0; i < lapNum; i++) {
            String key = Stopwatches.PREF_LAP_TIME + Integer.toString(i);
            editor.remove(key);
        }
        editor.remove(Stopwatches.PREF_LAP_NUM);
        editor.commit();
    }

I get the following error:

    01-26 20:54:41.571: E/_SharedPreferencesImpl_JSON(11826): Error while save preferences data
01-26 20:54:41.571: E/_SharedPreferencesImpl_JSON(11826): java.lang.RuntimeException: RemoveValueJSONManipulate: Manipulate failed
01-26 20:54:41.571: E/_SharedPreferencesImpl_JSON(11826):   at org.holoeverywhere.preference._SharedPreferencesImpl_JSON$EditorImpl.apply(_SharedPreferencesImpl_JSON.java:72)
01-26 20:54:41.571: E/_SharedPreferencesImpl_JSON(11826):   at org.holoeverywhere.preference._SharedPreferencesImpl_JSON$EditorImpl.commit(_SharedPreferencesImpl_JSON.java:93)
01-26 20:54:41.571: E/_SharedPreferencesImpl_JSON(11826):   at com.android.deskclock.Utils.clearSwSharedPref(Utils.java:171)
01-26 20:54:41.571: E/_SharedPreferencesImpl_JSON(11826):   at com.android.deskclock.stopwatch.StopwatchFragment.doReset(StopwatchFragment.java:453)
01-26 20:54:41.571: E/_SharedPreferencesImpl_JSON(11826):   at com.android.deskclock.stopwatch.StopwatchFragment.readFromSharedPref(StopwatchFragment.java:796)
01-26 20:54:41.571: E/_SharedPreferencesImpl_JSON(11826):   at com.android.deskclock.stopwatch.StopwatchFragment.onResume(StopwatchFragment.java:359)
01-26 20:54:41.571: E/_SharedPreferencesImpl_JSON(11826):   at android.support.v4.app.Fragment.performResume(Fragment.java:1543)
01-26 20:54:41.571: E/_SharedPreferencesImpl_JSON(11826):   at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:964)
01-26 20:54:41.571: E/_SharedPreferencesImpl_JSON(11826):   at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1105)
01-26 20:54:41.571: E/_SharedPreferencesImpl_JSON(11826):   at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
01-26 20:54:41.571: E/_SharedPreferencesImpl_JSON(11826):   at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1468)
01-26 20:54:41.571: E/_SharedPreferencesImpl_JSON(11826):   at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:440)
01-26 20:54:41.571: E/_SharedPreferencesImpl_JSON(11826):   at android.os.Handler.handleCallback(Handler.java:730)
01-26 20:54:41.571: E/_SharedPreferencesImpl_JSON(11826):   at android.os.Handler.dispatchMessage(Handler.java:92)
01-26 20:54:41.571: E/_SharedPreferencesImpl_JSON(11826):   at android.os.Looper.loop(Looper.java:137)
01-26 20:54:41.571: E/_SharedPreferencesImpl_JSON(11826):   at android.app.ActivityThread.main(ActivityThread.java:5103)
01-26 20:54:41.571: E/_SharedPreferencesImpl_JSON(11826):   at java.lang.reflect.Method.invokeNative(Native Method)
01-26 20:54:41.571: E/_SharedPreferencesImpl_JSON(11826):   at java.lang.reflect.Method.invoke(Method.java:525)
01-26 20:54:41.571: E/_SharedPreferencesImpl_JSON(11826):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
01-26 20:54:41.571: E/_SharedPreferencesImpl_JSON(11826):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
01-26 20:54:41.571: E/_SharedPreferencesImpl_JSON(11826):   at dalvik.system.NativeStart.main(Native Method)
01-26 20:54:41.575: E/_SharedPreferencesImpl_JSON(11826): Error while save preferences data
01-26 20:54:41.575: E/_SharedPreferencesImpl_JSON(11826): java.lang.RuntimeException: RemoveValueJSONManipulate: Manipulate failed
01-26 20:54:41.575: E/_SharedPreferencesImpl_JSON(11826):   at org.holoeverywhere.preference._SharedPreferencesImpl_JSON$EditorImpl.apply(_SharedPreferencesImpl_JSON.java:72)
01-26 20:54:41.575: E/_SharedPreferencesImpl_JSON(11826):   at com.android.deskclock.CircleTimerView.clearSharedPref(CircleTimerView.java:294)
01-26 20:54:41.575: E/_SharedPreferencesImpl_JSON(11826):   at com.android.deskclock.stopwatch.StopwatchFragment.doReset(StopwatchFragment.java:454)
01-26 20:54:41.575: E/_SharedPreferencesImpl_JSON(11826):   at com.android.deskclock.stopwatch.StopwatchFragment.readFromSharedPref(StopwatchFragment.java:796)
01-26 20:54:41.575: E/_SharedPreferencesImpl_JSON(11826):   at com.android.deskclock.stopwatch.StopwatchFragment.onResume(StopwatchFragment.java:359)
01-26 20:54:41.575: E/_SharedPreferencesImpl_JSON(11826):   at android.support.v4.app.Fragment.performResume(Fragment.java:1543)
01-26 20:54:41.575: E/_SharedPreferencesImpl_JSON(11826):   at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:964)
01-26 20:54:41.575: E/_SharedPreferencesImpl_JSON(11826):   at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1105)
01-26 20:54:41.575: E/_SharedPreferencesImpl_JSON(11826):   at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
01-26 20:54:41.575: E/_SharedPreferencesImpl_JSON(11826):   at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1468)
01-26 20:54:41.575: E/_SharedPreferencesImpl_JSON(11826):   at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:440)
01-26 20:54:41.575: E/_SharedPreferencesImpl_JSON(11826):   at android.os.Handler.handleCallback(Handler.java:730)
01-26 20:54:41.575: E/_SharedPreferencesImpl_JSON(11826):   at android.os.Handler.dispatchMessage(Handler.java:92)
01-26 20:54:41.575: E/_SharedPreferencesImpl_JSON(11826):   at android.os.Looper.loop(Looper.java:137)
01-26 20:54:41.575: E/_SharedPreferencesImpl_JSON(11826):   at android.app.ActivityThread.main(ActivityThread.java:5103)
01-26 20:54:41.575: E/_SharedPreferencesImpl_JSON(11826):   at java.lang.reflect.Method.invokeNative(Native Method)
01-26 20:54:41.575: E/_SharedPreferencesImpl_JSON(11826):   at java.lang.reflect.Method.invoke(Method.java:525)
01-26 20:54:41.575: E/_SharedPreferencesImpl_JSON(11826):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
01-26 20:54:41.575: E/_SharedPreferencesImpl_JSON(11826):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
01-26 20:54:41.575: E/_SharedPreferencesImpl_JSON(11826):   at dalvik.system.NativeStart.main(Native Method)

All of the imports are holoeverywhere's imports

Prototik closed this in 2b3653f Jan 27, 2014

Owner

Prototik commented Jan 27, 2014

btw drop me apk with your backport at the end ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment