Android存储
1、SharedPreferebce 存储
存储基本内容
1、SP存储数据类型 : boolean ,float ,int , long, String
2、数据保存路径 : data/data/packageName/shared_prefs//yyy.xml
3、可以设置当前应用私有的数据,别的应用访问不到
4、应用卸载时回删除此数据
相关API
SharedPreferences : 对应sp文件的接口
—context.getSharedPreferences(String name,int mode) 得到sp对象
name: 文件名(不带后缀,.xml)
mode:生成的文件文件模式是否是私有的,即其他应用是否可以访问
—Editor sp.edit() : 得到Editor对象
—Xxx sp.getXxx(name,defaultValue): 根据name得到对应的数据
Editor: 能更新sp 文件的接口
—Editor put(name, value) :保存一个键值对,没有真正保存到文件中
—Editor remove(name)
—commit(); 提交,数据真正保存到文件中了