Shared Preferences

1、SharedPreferences  class.

  Interface for accessing and modifying preference data returned by getSharedPreferences(String, int)

参考:http://android.xsoftlab.net/reference/android/content/SharedPreferences.html

2、getSharedPreferences(String, int mode)

  Retrieve and hold the contents of the preferences file 'name', returning a SharedPreferences through which you can retrieve and modify its values.

  Only one instance of the SharedPreferences object is returned to any callers for the same name, meaning they will see each other's edits as soon as they are made.

  Moe:Operating mode. Use 0 or MODE_PRIVATE for the default operation, MODE_WORLD_READABLE and MODE_WORLD_WRITEABLE to control permissions.

  MODE_WORLD_READABLE、MODE_WORLD_WRITEABLE is deprecated.

参考:http://android.xsoftlab.net/reference/android/content/Context.html#getSharedPreferences(java.lang.String, int)

3、Using Shared Preferences

  The SharedPreferences class provides a general framework that allows you to save and retrieve persistent key-value pairs of primitive data types. You can use SharedPreferences to save any primitive data: booleans, floats, ints, longs, and strings. This data will persist across user sessions (even if your application is killed).

参考:http://android.xsoftlab.net/guide/topics/data/data-storage.html#pref

Shared Preferences的更多相关文章

  1. 【起航计划 010】2015 起航计划 Android APIDemo的魔鬼步伐 09 App->Activity->Redirection 根据shared preferences是否有值决定是否redirect

    Redirection示例涉及到三个Acitivity: RedirectEnter, RedirectMain,RedirectGetter. 示例的主Activity为 RedirectEnter ...

  2. Android数据存储之Shared Preferences共享数据存储

    Android数据存储之Shared Preferences共享数据存储 在Android中一共提供了4种数据存储方式,但是由于存储的这些数据都是其应用程序私有的,所以如果需要在其他应用程序中使用这些 ...

  3. [安卓安全] 01.安卓本地数据存储:Shared Preferences安全风险浅析

    *:first-child { margin-top: 0 !important; } body > *:last-child { margin-bottom: 0 !important; } ...

  4. Android数据存储:Shared Preferences

    Android数据存储之SharedPreferences 在Android系统中提供了多种存储技术.通过这些存储技术可以将数据存储在各种存储介质上, Android 为数据存储提供了如下几种方式:1 ...

  5. Shared Preferences 数据存储

    SharedPreferences类,它是一个轻量级的存储类,特别适合用于保存软件配置参数. 其背后是用xml文件存放数据,文件存放在/data/data/<package name>/s ...

  6. Android 4 学习(15):持久化:Files, Saving State and Preferences

    参考<Professional Android 4 Development> 持久化:Files, Saving State and Preferences Android中的数据持久化 ...

  7. 【起航计划 031】2015 起航计划 Android APIDemo的魔鬼步伐 30 App->Preferences->Advanced preferences 自定义preference OnPreferenceChangeListener

    前篇文章Android ApiDemo示例解析(31):App->Preferences->Launching preferences 中用到了Advanced preferences 中 ...

  8. 【起航计划 028】2015 起航计划 Android APIDemo的魔鬼步伐 27 App->Preferences->Launching preferences 其他activity获取Preference中的值

    前给例子介绍了如何使用PreferenceActivity 来显示修改应用偏好,用户对Preferences的修改自动存储在应用对应的Shared Preferences中. 本例介绍了如何从一个Ac ...

  9. Android Weekly Notes Issue #233

    Android Weekly Issue #233 November 27th, 2016 Android Weekly Issue #233 本期内容包括: 用Mockito做RxJava的单元测试 ...

随机推荐

  1. mke2fs

    mke2fs - create an ext2/ext3/ext4 filesystem # mke2fs -b -c -N -t ext4 /dev/sdb #(注意末尾是/dev/sdb....? ...

  2. centos离线安装docker及其它软件包

    桌面版本安装 docker可以通过网络安装,但在内网环境,需要进行离线安装. 执行 uname -r 获取操作系统版本号 根据版本号,到docker.com下载docker的离线安装包: Linux版 ...

  3. uva-10340-水题

    题意:字符串匹配,看样例输入理解题意 直接循环 #include <string> #include<iostream> #include<map> #includ ...

  4. 1.App爬取相关库的安装(安装Charles及手机端证书安装配置)

    一.官网下载Charles安装包: https://www.charlesproxy.com/download1.下载对应版本 我这里下载的是 win 64 bit (下载完解压,双击打开charle ...

  5. RDD中的cache() persist() checkpoint()

    cache只有一个默认的缓存级别MEMORY_ONLY ,而persist可以根据StorageLevel设置其它的缓存级别. cache以及persist都不是action. 被重复使用的(但是)不 ...

  6. 30. linux用su oracle 切换用户报“连接数据库报-bash-4.1$”处理方式

    直接在-bash-4.1$后面加上export PS1="[\u@\h \w]"即可,如下: [root@localhost usr]# su oracle-bash-4.1$ e ...

  7. python第三方库自动安装脚本

    #python第三方库自动安装脚本,需要在cmd中运行此脚本#BatchInstall.pyimport oslibs = {"numpy","matplotlib&qu ...

  8. python网络图片爬取存储全代码

    #图片爬取全代码import requestsimport osurl = "https://timgsa.baidu.com/timg?image&quality=80&s ...

  9. Java并发:线程间数据传递和交换

    转自:https://www.cnblogs.com/java-zzl/p/9741288.html 一.通过SynchronousQueue方式实现线程间数据传递: 线程A与线程B共同持有一个Syn ...

  10. PT 转 PX

    pt (point,磅):是一个物理长度单位,指的是72分之一英寸. px (pixel,像素):是一个虚拟长度单位,是计算机系统的数字化图像长度单位,如果px要换算成物理长度,需要指定精度DPI(D ...