Android 共享首选项值的最大大小是多少? [英] What's the maximum size for an Android shared preference value?

查看:24
本文介绍了Android 共享首选项值的最大大小是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我完全理解将大量数据转储到首选项中是完全不合适的,但我的要求不是那么大,但足够大(可能是 500-5000 字节),我不知道它是否合适.文档没有帮助.http://developer.android.com/reference/android/content/SharedPreferences.Editor.html

I fully appreciate dumping lots of data into the preferences is totally inappropriate, but my requirement is not that great, but large enough (potentially 500-5000 bytes) where I've no idea whether it's appropriate or not. The docs do not help. http://developer.android.com/reference/android/content/SharedPreferences.Editor.html

我在网上和 Stackoverflow 上搜索过,但没有找到明确的答案:a) 实际限制是什么,基于底层架构b) 基于性能的实际限制是什么(我发现即使写入较短的偏好值也可能需要几秒钟,但我怀疑这只是闪存写入延迟)

I've searched the net and Stackoverflow and can't find a definitive answer on: a) what the actual limit is, based on the underlying architecture b) what the practical limit is, based on performance (I find writing even short pref values can take a few seconds, but I suspect that's just a flash write delay)

希望得到澄清.

推荐答案

所有共享首选项都存储在/data/data/[package name]/shared_prefs/[app name].xml 中,所以我认为没有基于架构的限制.

All shared prefs are stored in /data/data/[package name]/shared_prefs/[app name].xml, so i think there's no limit based on architecture.

我不知道实际限制,但我认为对你来说已经足够了.

I don't know practical limit but I think it's enough for you.

这篇关于Android 共享首选项值的最大大小是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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