android - Loading a stored json from SharedPreferences -


problem

This problem has been going to annoy me for a long time . This is not very common, but it happens from time to time. The problem is:

I save a group of user preferences in the SGSN serial object in shared priorities. In this way, when I need an object I load it in memory, only to make 1 call on the storage. However, for some bizzare reason I am getting this error:

  java.lang.RuntimeException: java.lang.RuntimeException: activity {com.ab / com.abSomeActivity} resume Unable to unable to parse type class com.abstorage.SomeClass $ AppSettings with json: rialFinished ": false," lastOpenedAppId ": 0," appVersion ": 35," tutorialFinished ": false}   

, json was not loaded properly, it is an invalid Jason, so throws an exception in trying to parse it.

Some extreme False Facts

  • P> This is not a 'device specific issue' or at least I think so. Proof: Enter image details here
    As you can see, this is not specific to the device I also know about a fact that it is not specific to the Android version, we can log it from Android 2.3.6 , 4.0.3 , 4.1 These are done by 1 , 4.1.2 , 4.0.4

  • The class which did the serial Gone

    Class AppSettings {Personal Boolean Tutorial Finished; Personal Boolean googleAuthTutorialFinished; Private Ent app; PrivateIcon lastOpenedAppId; Public app settings () {tutorialFinished = false; App version = NO_STORED_VERSION; GoogleAuthTutorialFinished = false; } Public Boolean isTutorialFinished () {returnForished tutorial; } Public Zero setTutorialFinished (Boolean Tutorial Finished) {this.tutorialFinished = tutorialFinished; } Public Zero Set Up Statement (int app variance) {this.appVersion = appVerions; } Public Zero Set GoogleAuthTutorialFinished (Boolean googleAuthTutorialFinished) {this.googleAuthTutorialFinished = googleAuthTutorialFinished; } / ** * * @ Return to the archived app version or {@link AppSettingsStorage # NO_STORED_VERSION}, if none found * / public int getAppVerions () {apprerence return}; } Public Boolean is GoogleAuthTutorialFinished () {return googleAuthTutorialFinished; } Public int getLastOpenedAppId () {lastOpenedAppId; } Public Zero SettleStepAndAPIDID (ITAPODADID) {this.lastOpenedAppId = lastOpenedAppId; The method used to load Json is:
      Private TJ Jason (String Jason) {try {return GSN. From Jason (jsn, type); } Hold (Exception e) {New Runtime Exception ("Type" + Type + "Unable to Parson with Jason": "+ JSN";}}  

Possible reason:

  • This issue points out that some Android devices do not work well with the shared portion. Sure this specific case is not here, I wonder if there is something to do.

  • Perhaps there is some strange process-security problem here ()

  • App settings are an internal class. Will anyhow affect Gson ordering?

double quote

are you losing?

  type class with json com.abstorage.SomeClass $  

should be:

Unable to parse type class com.abstorage.SomeClass $ AppSettings with json: "rialFinished": false, "lastOpenedAppId": 0, "Apon Warson": 35, "Ti Toriyl finish was "false}


Comments