简体   繁体   English

从 SQLite 数据库中检索 TextView 属性

[英]Retrieve TextView attributes from SQLite db

I have 10 TextViews, their text and visibility is stored in an SQLite db.我有 10 个 TextView,它们的文本和可见性存储在 SQLite 数据库中。 When an activity loads, I need to grab these values and apply them to the TextViews.当活动加载时,我需要获取这些值并将它们应用到 TextViews。

My db is currently structured as: _id, textviewID, text, visibility .我的数据库目前的结构为: _id, textviewID, text, visibility What would be the best way to access these values and apply them to the correct TextView?访问这些值并将它们应用于正确的 TextView 的最佳方法是什么?

Take a look atthis article , this post , and of course the Android Developer's topic on how to retirieve values from an sqlite db.看看这篇文章这篇文章,当然还有Android 开发人员关于如何从 sqlite 数据库中检索值的主题。

For these kind of configurations SharedPreferences are way more handy solution.对于这些类型的配置SharedPreferences是更方便的解决方案。 If your design is not strict to use the local database for storing application preferences, you should consider it as an option.如果您的设计不严格使用本地数据库来存储应用程序首选项,则应将其视为一种选择。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM