简体   繁体   English

如何显示资产文件夹中数据库中的数据并通过ListView进行查看

[英]How can i display the data in my database located in my assets folder and view it VIA ListView

Im making a Dictionary App for my subject and my plan is to view the content of My Data.db using ListView . 我正在为我的主题制作字典应用程序,我的计划是使用ListView查看My Data.db的内容。

I've read this blog about using sqlite in android but I'm "NEW" in android programming. 我已经阅读了有关在android中使用sqlite的博客,但是在android编程中我是“ NEW”。 :( :(

The article link sort of answers your question. 文章链接可以回答您的问题。 It shows how to copy a db from your local assets folder into the db your application uses. 它显示了如何将数据库从本地资产文件夹复制到应用程序使用的数据库中。 Android is set up to create databases for you, as such it keeps them in its own file path location. Android被设置为为您创建数据库,因此它将数据库保留在其自己的文件路径位置。 Lots of tutorials show how to copy a db from your assets folder to the Application DB. 许多教程展示了如何将数据库从资产文件夹复制到应用程序数据库。 This tends to be a one of installation/setup procedure after which you'd use the content provider to store data in the default location used by android. 这往往是安装/设置过程之一,此后您将使用内容提供程序将数据存储在android使用的默认位置。

Ie you might provide the user with a reset option, that would carry this out, wiping existing db but replacing it with a valid empty db. 也就是说,您可以为用户提供一个重置选项,该选项可以执行此操作,擦除现有数据库,但将其替换为有效的空数据库。

The following article looked up on google goes into some depth to that would give you further help using content providers and list. 下面的文章在google上进行了深入研究,可以为您提供有关内容提供商和列表的进一步帮助。 You might have to combine it with the tutorial you already have if it doesn't cover loading a db from the assets folder. 如果它不涉及从assets文件夹中加载数据库,则可能需要将其与现有教程结合使用。

http://www.vogella.com/articles/AndroidSQLite/article.html http://www.vogella.com/articles/AndroidSQLite/article.html

暂无
暂无

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

相关问题 如何在列表视图中将数据显示到主屏幕小部件中? - how can I display data in my listview into my homescreen widget? 如何在列表视图中显示数据库中的数据? - How do i display data from my database in a listview? 如何在列表视图中一一显示数据库中的数据? - How can I display data from database in my listview one by one? 如何从数据库的listView中的选定项中获取数据并在alertdialog上查看? - how I can get the data from the selected item in the listView from my database and view it on alertdialog? 如何使用游标从数据库中提取数据以在ListView中使用,而不必在ListView的列中显示该数据? - How can I extract data from my database with a Cursor for use in a ListView, but not have to display that data within a column in the ListView? 如何保护我的数据库sqlite在Assets文件夹中(通过加密)? - How do I secure my Database sqlite in the Assets Folder (by Ciphering)? 如何从我的View类访问资产? - How can I access my Assets from my View class? 如何获取数据库信息以文本视图显示? - How can I get my database information to display in a text view? 如何在资源文件夹中获取图像的字符串路径 - How can I get a string path of an image in my assets folder 将位于Assets文件夹中的预填充数据库获取到data / data / mypackage / databases中 - Getting a prepopulated database located in the Assets folder into the data/data/mypackage/databases
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM