Android中的偏好和共享偏好之间的差异 [英] Difference between preference and shared preference in Android

查看:171
本文介绍了Android中的偏好和共享偏好之间的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Android中的偏好和共享偏好的概念对我来说很混乱。有什么区别?

解决方案

:这些用于在XML文件中存储值。 Android会为您创建,维护和删除这些文件。它们未加密,很容易当用户植根他/她的手机时改变了(很适合开发)。请勿将这些信息用于敏感信息。上面提到的首选项使用共享首选项作为底层系统。


The concept of preferences and shared preferences in Android are mixed up for me. What is the difference?

解决方案

Preferences: The user interface part of the settings. It contains different classes which allow to composes Settings screens from code or XML. They can look like this:

Shared Preferences: These are used to store values in XML files. These files are created, maintained and deleted by Android for you. They are not encrypted and can easily be changed when the user has rooted his/her phone (nice for development). Don't use these for sensitive information. The above mentioned Preferences use Shared Preferences as the underlying system.

这篇关于Android中的偏好和共享偏好之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆