In my Android application, I encoded to read the general data of another Android application, and then remove that data from the general settings. My code is as follows:
try { con = createPackageContext("com.testapp.ws", 0); SharedPreferences pref = con.getSharedPreferences("demopref", Context.MODE_PRIVATE); ipAdr = pref.getString("demostring", "No Value"); pref.edit().remove("demopref").commit(); }
This shows the following error:
06-12 11:52:07.400: E/ApplicationContext(3587): Couldn't rename file /data/data/com.testapp.ws/shared_prefs/demopref.xml to backup file /data/data/com.testapp.ws/shared_prefs/demopref.xml.bak
I used this method in my other application to create shared data
public void shareData(){ String strShareValue = ip; SharedPreferences prefs = getSharedPreferences("demopref",Context.MODE_WORLD_READABLE); SharedPreferences.Editor editor = prefs.edit(); editor.putString("demostring", strShareValue); editor.commit(); }
How can i do this? Can I add a manifest file?
Thanks!
Grant source share