sharepreference不同应用其间进行读写

sharepreference不同应用之间进行读写
急....急....急....我需要在一个应用A里面些另外一个应用B里面的sharepreference.xml文件的一项。但是我在A里面写完之后,到B应用的xml文件中查看时值一直没有变。但是在A中读出来的是已经变的。代码如下:A代码如下:
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();
}

在B中已经设置了Context.MODE_WORLD_WRITEABLE属性。

求救阿

------解决方案--------------------
引用:
急....急....急....我需要在一个应用A里面些另外一个应用B里面的sharepreference.xml文件的一项。但是我在A里面写完之后,到B应用的xml文件中查看时值一直没有变。但是在A中读出来的是已经变的。代码如下:A代码如下:


Java code
?



1234567891011

try{                 otherAppsContex……


.... 如果你想改变xml文件内容  你必须解析xml 读写的方式改变啊~    otherEditor.commit();方法只能改变当前缓存中的数据值  不能直接改变xml中的内容的
------解决方案--------------------
原来也遇到过这个问题 后来改用contentprovider了,期待解决。
------解决方案--------------------
otherAppsContext = MainActivity.this.createPackageContext("a的包", Context.CONTEXT_IGNORE_SECURITY);
SharedPreferences otherSharedPreferences = otherAppsContext.getSharedPreferences("bbb",Context.MODE_WORLD_WRITEABLE);写在B里面吧
------解决方案--------------------
引用:
引用:
otherAppsContext = MainActivity.this.createPackageContext("a的包", Context.CONTEXT_IGNORE_SECURITY);
SharedPreferences otherSharedPreferences = otherAppsContext.getSharedPrefere……


如果是这样的话,你设置修改了Setiings中铃声  则发送一个广播去通知相应的应用去改变  反之  一样
------解决方案--------------------
楼上的方法就可以的,进程间的通信以前用过aidl,后来发现逻辑上有问题,就又用广播了