我想通过另一个应用程序来编辑一个应用程序的
SharedPreferences
,我的代码如下:try {
Context plutoContext = getApplicationContext().createPackageContext("me.test",Context.MODE_WORLD_WRITEABLE);
SharedPreferences plutoPreferences = PreferenceManager.getDefaultSharedPreferences(plutoContext);
Editor plutoPrefEditor = plutoPreferences.edit();
plutoPrefEditor.putString("country", "India");
plutoPrefEditor.commit();
}
我遇到了一个错误
E/SharedPreferencesImpl( 304): 无法为SharedPreferences文件 /data/data/me.test/shared_prefs/me.test_preferences.xml 创建目录
其中me.test
是我的另一个项目,
在me.test项目中,我可以轻松编辑和检索SharedPreferences
我正在Nexus S android 4.0.4 (Samsung)上进行测试,有人能帮我吗?
MODE_WORLD_WRITEABLE
创建了SharedPreferences? - WarrenFaithMODE_WORLD_WRITEABLE
,我只是创建了普通的。 - Sharanabasu Angadi