Android:预加载数据库到表布局视图
我一直在试图弄清楚如何从资产文件夹中的预填充数据库中提取信息以在表格布局视图中显示。如果您知道任何清晰的教程或者您知道如何操作,请帮助我。
我的意思的示例:
数据库示例:
Mountains Valleys Rivers Oceans
Vermount yes no yes no
kentucky no yes yes no
南达科他州 yes no no no
(在应用程序中,如果我要显示特定行,则表格布局应如下所示
)
South Dakota <--(I know how to put the header)
Mountains yes
Valleys no
Rivers no
Oceans no
Im stuck trying to figure out how to pull the information from my pre-populated database that is in my assets folder to display in a tablelayout view. If you know of any clear tutorials or if you know how to do it could you please help me out.
Example of what I mean:
Database example:
Mountains Valleys Rivers Oceans
Vermount yes no yes no
kentucky no yes yes no
South Dakota yes no no no
(In the app if I was to display a specific row then the tablelayout should appear like this)
TableLayout View
South Dakota <--(I know how to put the header)
Mountains yes
Valleys no
Rivers no
Oceans no
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我必须做类似的事情,但不需要光标。这是我最终为我的项目所做的事情。它会出现一个显示无限进度微调器的对话框。
I had to do something similar, but didn't need a cursor. Here is what I ended up doing for my project. It takes in a dialog that displays the infinite progress spinner.
为什么要把它添加到TableLayout中呢?
因此使用多列ListView设置列类型中的所有值,
请查看Android 中的多列 ListView
Android – 多列 ListView
Why are you want to add it in TableLayout?
So use Multicolumn ListView to set all values in column type,
Look at Multicolumn ListView in Android
Android – Multi Column ListView
我相信您需要将数据库文件从资产文件夹复制到其他地方才能使用它
这个问题有相关内容
Android:访问具有 .sqlite 扩展名的资产文件夹 sqlite 数据库文件
I believe you need to copy the Database file out from your assets folder to somewhere else before you can use it
This question has related content
Android: Accessing assets folder sqlite database file with .sqlite extension