跨apk访问SharedPreferences
来源:互联网 发布:淘宝店招图片素材 编辑:程序博客网 时间:2024/04/28 11:58
//该activity生成一个SharedPreferences
//1:APK->activity
//包名:com.test.pkg
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
SharedPreferences mPrefs = getSharedPreferences("com.test.pkg_preferences",Context.MODE_WORLD_READABLE );
//注意这里的 Context.MODE_WORLD_READABLE
{
super.onCreate(savedInstanceState);
SharedPreferences mPrefs = getSharedPreferences("com.test.pkg_preferences",Context.MODE_WORLD_READABLE );
//注意这里的 Context.MODE_WORLD_READABLE
}
//访问上一个activity的SharedPreferences
//2:APK->activity
public void onCreate(Bundle savedInstanceState)
{
Context otherAppsContext = null;
try
{
otherAppsContext = createPackageContext(
"com.test.pkg", 0);
}
catch (NameNotFoundException e)
{
}
{
Context otherAppsContext = null;
try
{
otherAppsContext = createPackageContext(
"com.test.pkg", 0);
}
catch (NameNotFoundException e)
{
}
SharedPreferences mPrefs = otherAppsContext.getSharedPreferences("com.test.pkg_preferences",Context.MODE_PRIVATE);
}
}
http://blogold.chinaunix.net/u2/77494/showart_2386151.html
- 跨apk访问SharedPreferences
- 跨apk访问SharedPreferences
- 跨apk访问SharedPreferences
- 跨apk访问SharedPreferences
- Android跨程序访问SharedPreferences
- 不同App共享SharedPreferences(跨activity, application访问SharedPreferences)
- Android跨包访问SharedPreferences空指针!
- 访问SharedPreferences中的数据
- SharedPreferences跨进程访问
- Android 跨APK访问另外一个APK的资源
- SharedPreferences访问与修改记录
- android 两个apk之间恭喜数据SharedPreferences
- 从一个apk读另外一个apk的sharedpreferences
- Android 数据存储与访问 SharedPreferences
- 使用SharedPreferences进行数据存储与访问
- [Android SQLite]数据存储与访问 - SharedPreferences
- Android数据存储和访问(SharedPreferences存储)
- 使用SharedPreferences进行数据存储并访问
- 北京是什么地方?
- hdu1298 T9
- linux yum java tomcat nginx整合
- 开启MySQL慢查询日志
- 用C#获取局域网内所有IP方法研究
- 跨apk访问SharedPreferences
- U-boot 2011.06 smdk6410的移植(转载-测试通过-修改)--下载后还不能运行......
- Jquery AutoComplete的使用方法实例
- 分别利用利用SAX、DOM、PULL三种方法解析XML文档
- 用Flex3.0导入代码
- HQL查询需要的某些字段,提高查询速度
- 18款适用于开发人员的网页代码编辑器
- 【HNOI2002】营业额统计 //SPLAY TREE
- vmware 下找不到ifcfg-eth0的问题