检索黑莓上的所有 PersistentStore 密钥
我的应用程序使用 PersistentStore 来存储数据。 PersistentStore 的键是在运行时创建的,因此无法知道所有键。我想知道是否有办法检索或列出我的应用程序使用的持久存储密钥。我想将它们放在 ObjectChoiceField 上并选择我想要使用的一个。
我的应用程序创建一个名称作为字符串,然后将该字符串转换为用作键的长值。我目前正在考虑将 PersistentStore 的名称存储在单个 RMS 上,并用它检索密钥。但我想保留这个选项作为最后的手段。
My application uses the PersistentStore to store data. The keys of the PersistentStore are created at runtime, so there's no way to know all the keys. I'd like to know if there's a way to retrieve or list the persistent store keys used by my application. I want to put them on a ObjectChoiceField and select the one I want to work with.
My application creates a name as a string, and then turns the string into a long value used as a key. I'm currently thinking to store the names of the PersistentStore on a single RMS, and with it retrieve the keys. But I would like to keep this option as a last resort.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您确实希望使用众所周知的密钥,而不是在运行时生成它们。持久存储在设备上的所有应用程序之间共享,并且我不知道有什么方法可以列出所有密钥。
您可以在生成时存储所有密钥,这可能是您建议的最后手段。您仍然需要保留一个众所周知的密钥,并使用该众所周知的密钥来存储已生成的所有其他密钥的向量或数组。
You really want to use well-known keys rather than generating them at runtime. The persistent store is shared across all apps on the device, and I'm not aware of any way to list all the keys.
You could store all the keys as they are generated, which may be what you are suggesting as your last-resort. You would still need to keep one well-known key, and use that well-known key to store a Vector or array of all the other keys that have been generated.