首先在当前进程也就是当前的项目里面进行存储

SharedPreferences.Editor editor = mContext.getSharedPreferences("tvplay", Context.MODE_PRIVATE).edit();
editor.putString("video", content.getString("video"));
editor.commit();

这是存

SharedPreferences preferences = getTargetContext().getSharedPreferences("tvplay", Context.MODE_PRIVATE);
video = preferences.getString("video", "");

这是取

跨进程SharedPreferences进程存储

SharedPreferences.Editor editor = mContext.getSharedPreferences("tvplay", Context.MODE_WORLD_READABLE).edit();
editor.putString("video", content.getString("video"));
editor.commit();

这是存跟上面存唯一不同就是模式换了,不懂可以百度!

private static final String TARGET_PACKAGE_NAME = "com.sdmc.hotel.ollauncher";// 目标数据程序的包名,

SharedPreferences preferences = getTargetContext().getSharedPreferences("tvplay", Context.MODE_PRIVATE);
video = preferences.getString("video", "");

private Context getTargetContext(){
try {
return createPackageContext(TARGET_PACKAGE_NAME, Context.CONTEXT_IGNORE_SECURITY);
} catch (NameNotFoundException e) {
e.printStackTrace();
}
return null;
}

这是取,跟上面不同的就是要创建一个你要取的进程的context,然后在调用getSharedPreferences()方法

最新文章

  1. 在微软伪静态处理机制下action导致伪静态的地址重现的问题
  2. Json.NET读取和写入Json文件
  3. Android深度探索--HAL与驱动开发----第四章读书笔记
  4. 使用markdown编辑evernote(印象笔记)的常用方法汇总
  5. zookeeper初识之原理
  6. jQuery 事件用法详解
  7. 对.NET的认识
  8. android开发之重写Application类
  9. Core OS 层
  10. 【转】C++虚函数解析
  11. hudson任务配置说明
  12. 使用JS实现鼠标悬浮切换显示
  13. MySQL replication illegal mix of collations
  14. 监督学习——logistic进行二分类(python)
  15. CODING 敏捷实践完全指南
  16. tensorflow, TypeError:'Tensor' object is not callable
  17. luogu P1762 偶数
  18. 我的Visual Studio必用工具
  19. Java中如何遍历Map对象
  20. C/C++之宏、内联函数和普通函数的区别

热门文章

  1. Scala - 快速学习04 - 求值策略
  2. socket 实现单一串口共享读写操作
  3. [原创]K8 DB_Owner权限GetShell工具
  4. 在 .NET Core 下的 Swagger UI 自定义操作
  5. 关于 Kubernetes 中的 Volume 与 GlusterFS 分布式存储
  6. Android权限大全(链接地址整理)
  7. 从零基础到拿到网易Java实习offer,谈谈我的学习经验
  8. Java单元测试(Junit+Mock+代码覆盖率)
  9. Python快速学习03:运算 & 缩进和选择
  10. 面试必备技能-HiveSQL优化