ME .... ME .... ME .... I need an application A which is another one of those B inside sharepreference.xml file applications. But after I finished inside A to B application to view the time when the xml file has not changed. But read out in A it is already change. Code is as follows: A code is as follows:
try {
otherAppsContext = MainActivity.this.createPackageContext ("com.example.sharepreferencewww", Context.CONTEXT_IGNORE_SECURITY);
SharedPreferences otherSharedPreferences = otherAppsContext.getSharedPreferences ("bbb", Context.MODE_WORLD_WRITEABLE);
Editor otherEditor = otherSharedPreferences.edit ();
otherEditor.putString ("aaa", "sssdd");
otherEditor.commit ();
} Catch (Exception e) {
// Log.d ("kk", "" + e.printStackTrace ());
e.printStackTrace ();
} In the B Context.MODE_WORLD_WRITEABLE property has been set.
Help A
Reply:
.... If you want to change the contents of the file you have to parse xml reader xml change the way ah ~ otherEditor.commit (); method can only change the value of the current data in the cache can not directly change the contents of xml
Reply:
Can give an example, I was in was too dishes, thank you ....!
Reply:
And why in the same application which should not parse xml files? This is very clear. Thank you!
Reply:
Had also encountered this problem later switched contentprovider, and look forward to solve.
Reply:
otherAppsContext = MainActivity.this.createPackageContext ("a package", Context.CONTEXT_IGNORE_SECURITY);
SharedPreferences otherSharedPreferences = otherAppsContext.getSharedPreferences ("bbb", Context.MODE_WORLD_WRITEABLE); B written on the inside of it
Reply:
understand what you say, I just want to modules such as calendar / information ring setting, move the setting inside, so to be. A is setting.b other modules.
Reply:
If this is the case, you set the modified and vice versa in the same tones Setiings send a broadcast to inform the appropriate application to change
Reply:
Upstairs on the can, inter-process communication previously used aidl, later found to have problems logically, and again with broadcast
Reply:
Will com.android.settings_preferences.xml this setting module file is created there. Looking for a long time did not find.
Reply:
Asynchronous communication uses SharePreference.Edit (). Apply ()
Reply:
.Over the past so long I do not know the landlord did not solve, this man said is right, but you must be able to call this method reflected:
Class clz = SharedPreferences.Editor.class;
clz.getMethod ("apply") invoke (editor);.
for reference only
Reply:
getSharedPreferences ("data", Context.MODE_WORLD_WRITEABLE + Context.MODE_WORLD_READABLE + Context.MODE_MULTI_PROCESS); plus the authority will be able to read and write can be either synchronous
No comments:
Post a Comment