【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. gentoo samba 配置

    准备搞一台 PC 作为 NAS, 开启 SAMBA 作为文件服务器.考虑多个手机自动备份到不同的文件夹,可以通过盒子进行播放,还要密码防护. 所以在配置文件里面 valid users 这里把 手机和 ...

  2. scp(secure copy)安全拷贝

    scp(secure copy)安全拷贝 (1)scp定义: scp可以实现服务器与服务器之间的数据拷贝.(from server1 to server2) (2)基本语法 命令  递归  要拷贝的文 ...

  3. uva-270-排序

    题意:很多个点,问,最多有多少个点在同一条直线上 #include <algorithm> #include <iostream> #include <string> ...

  4. 【转】Exchange Server 的防火墙开放端口

    关于exchange所用到的端口参阅下面的文档, 适用于exchange2010sp2. http://technet.microsoft.com/en-us/library/bb331973.asp ...

  5. Linux 配置开机自启 和 修改环境变量

    [ 操作系统 Centos7 ] 一,开机自动启动的配置 1,赋予 /etc/rc.local 的执行权限 => chmod +x /etc/rc.local 2,在 /etc/rc.local ...

  6. Web移动端布局

    说到移动端,不得不提适配问题,因为现如今市面上移动设备的分辨率大小不同,显然咱们常用的px单位在这个时候就有些不太灵光了,为此,css3出了一个新单位——rem,rem是移动端神器,它完美解决了分辨率 ...

  7. Oracle的基本数据类型(常用)

    转自:https://www.2cto.com/database/201810/783959.html 1.字符型 Char 固定长度字符串 占2000个字节 Varchar2 可变长度字符串 占40 ...

  8. js/jquery this 坑

    重要:js onclick() 函数中,取不到this !!! 错误的写法: function test(){ $(this).parent().addClass('active') } 正确的写法是 ...

  9. 解决git中文乱码问题

    三条命令fix乱码问题: git config --global gui.encoding utf-8 git config --global i18n.commitencoding utf-8 gi ...

  10. clientX,screenX,pageX,offsetX的异同

    pageX/pageY: 鼠标相对于整个页面的X/Y坐标.注意,整个页面的意思就是你整个网页的全部,比如说网页很宽很长,宽2000px,高3000px,那pageX,pageY的最大值就是它们了. 特 ...