Android的数据库大小惯于减少对HTC霹雳 [英] Android Database Size Wont Decrease On HTC Thunderbolt

查看:102
本文介绍了Android的数据库大小惯于减少对HTC霹雳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新:DB-沃尔玛文件是如此之大。的原因是什么?如何限制sqlite的日志文件的大小?

update: the db-wal file is what is so large. what is the cause and how do i limit sqlite logging file size?

我使用的是SQLiteOpenHelper。当onUpgrade发生时,我每下降存在于我的应用程序表。就当我看看使用的设置应用程序的应用程序的数据大小的机器人,你可以看到,数据的大小减小像它应该。但与HTC霹雳数据大小不会降低。更糟糕的是,迅雷的数据库继续当你开始再次使用我的应用程序增长。它看起来好像数据库将一直生长在迅雷当我升级数据库版本。

I am using a SQLiteOpenHelper. When onUpgrade occurs i am dropping every table that exists for my app. On the droid when i look at the applications data size using the settings app, you can see that the data size decreases like it should. But with the HTC Thunderbolt the data size does not decrease. What's worse is that the Thunderbolt's database continues to grow when you begin to use my app again. It appears as if the database will always grow on the Thunderbolt when i upgrade the database version.

我核实,我只使用一个数据库具有相同的名称,而且有一个在数据库中的数据之前,我放弃了表。我希望看到在迅雷相同的行为,因为我做的机器人。有什么办法,我可以通过编程清除所有数据的设备?这不是很理想,但它是不是让迅雷的数据大小总是更好地成长。

I have verified that i am using only one database with the same name and that there was data in the database before i dropped the tables. I expect to see the same behavior on the Thunderbolt as i do on the droid. Is there any way i can programmatically clear all data for a device? This wouldn't be ideal, but it would be better than having the data size of the Thunderbolt always grow.

推荐答案

如果您使用的是SQLiteOpenHelper,你需要调用close当你的应用程序结束。 API文档提到,你不需要调用close在所有被它打开了SQLiteDatabase实例,但你还是必须调用close的助手,因为它缓存并跟踪SQLiteDatabase的所有打开的实例。如果没有调用close,沃尔玛文件将继续增长,为每个不同的实例getWriteableDatabase和getReadableDatabase回报。

If you are using a SQLiteOpenHelper, you need to call close when your application ends. The api docs mention that you do not need to call close on all of the SQLiteDatabase instances that are opened by it, but you still must call close on the Helper because it caches and tracks all open instances of SQLiteDatabase. Without calling close, the wal file will continue to grow for every different instance that getWriteableDatabase and getReadableDatabase return.

这篇关于Android的数据库大小惯于减少对HTC霹雳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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