在android应用大SQLite数据库 [英] big sqlite database in android application

查看:120
本文介绍了在android应用大SQLite数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想建立字典应用程序(实际上它是谷歌SearchableDictionary采样的修改),他的话和他们的定义来源是非常大的,5MB左右。我试了很多办法,用多种格式,它仍然无法在Android上正常运行。 SQLite数据库应该是最好的解决办法,我已经把它和它的大小为10MB(试用过之前的运行时间和运行过程中建立的话)。 主要的问题是定义的大小,但我看到了一些其他的应用已经成功地做​​到这一点。这可能是有内置Android系统的一些文件大小的限制,但不管怎么说,如果他们werent这一切全部是这么多,在这个SQLite数据库搜索和运行查询。

I am trying to build dictionary app(actually it is a modification of google SearchableDictionary sample), whose source of words and their definitions is very big, around 5MB. I tried many ways and using many formats and it still cant run properly on android. Sqlite database should be the best solution, I have built it and its size is 10MB(tried building it both before runtime and during runtime). The main problem is the size of the definitions, but I have seen some other applications have managed to do this. It might be that there are some file size limits built into android system, but anyways if they werent it all takes so much to search and run queries in this sqlite database.

我究竟做错了什么? BTW:它必须是离线词典(下载定义最大1次)

What am I doing wrong? BTW: It HAS to be offline dictionary (download definitions max 1 time).

简而言之问题:

word -definition 
word2 -definition2...

存储在一个10MB的SQLite数据库(试图从资产加载),无法正常工作。 随着一些黑客(手动与Eclipse DDMS工具加载它),这是工作,但非常缓慢。

Stored in a 10MB sqlite database (tried loading it from assets), not working. With some hacks (loading it manually with eclipse DDMS tool) it is working but terribly slow.

推荐答案

您加载从资产文件夹中的数据库?如果是的话,那么这就是你的问题。有什么是资产的文件夹(1MB我相信)的文件大小限制。

Are you loading the database from the Assets folder? If yes, then that's your problem. There is a file size limit on what is in the assets folder (1mb I believe).

您有两种选择:

  1. 拆分数据库分成多个1MB的文件
  2. 创建一个Web服务。让你的应用程序调用这反过来又下载了数据库,以你的Andr​​oid设备中的web服务。或创建应用程序使用,以获得它需要它的基础数据的Web服务API。

这篇关于在android应用大SQLite数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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