These two days change colleague Intercept assistant bug but changed, find for a long time did not find the wrong reason, finally carefully think of a multi-process to share data problem, finally found the problem, is he in a service to read the configuration file, and modify the configuration file is in an activity inside, He set the service to be in a process that is not the same process as the activity, resulting in inconsistent data and read data after Setup.
The best place to use sharedpreference is to keep the configuration information, and the data store in Android with a preference-specific preferencefragment is also stored using sharepreference, the default file name is (your PackageName) in _preferences.xml. If you want to modify the default file name, you can do so by using Getpreferencemanager () in preferencefragment. Setsharedpreferencesname ("Modify_default_ Preference ") to change the default file name.
None of this matters. It is important to modify the same value in a multi-process problem. To facilitate the description, the process of creating a sharedpreference XML for the first time is described as the primary process, and the second time that the XML file is used is the secondary process
Different processes refer to the different processes seen in DDMS, including different applications (Shareduid also in the same), and the process generated by the configuration process in the same application. The communication between them will cause the main process to modify the value, which is read by the secondary process when it is initialized the first time.
Shapedperference use the problem to be noted