gpt4 book ai didi

java - ListView内存问题

转载 作者:行者123 更新时间:2023-12-01 15:14:51 26 4
gpt4 key购买 nike

我正在使用 listview 将超过 50 个项目存储到 listview 中,但在插入第 20 个项目后,错误显示在日志猫中,如下所示。

08-02 12:50:34.646: E/CursorWindow(5245): not growing since there are already 16 row(s), max size 1048576
08-02 12:50:34.646: E/Cursor(5245): Failed allocating 69485 bytes for text/blob at 24,8
08-02 12:50:34.695: D/Cursor(5245): finish_program_and_get_row_count row 25
08-02 12:50:35.365: E/CursorWindow(5245): need to grow: mSize = 1048576, size = 69485, freeSpace() = 9795, numRows = 16
08-02 12:50:35.365: E/CursorWindow(5245): not growing since there are already 16 row(s), max size 1048576
08-02 12:50:35.365: E/Cursor(5245): Failed allocating 69485 bytes for text/blob at 23,8
08-02 12:50:35.396: D/Cursor(5245): finish_program_and_get_row_count row 26
08-02 12:50:35.896: D/Cursor(5245): skip_rows row 7
08-02 12:50:35.905: E/CursorWindow(5245): need to grow: mSize = 1048576, size = 69485,
freeSpace() = 9795, numRows = 16
08-02 12:50:35.905: E/CursorWindow(5245): not growing since there are already 16 row(s), max size 1048576
08-02 12:50:35.905: E/Cursor(5245): Failed allocating 69485 bytes for text/blob at 22,8
08-02 12:50:35.936: D/Cursor(5245): finish_program_and_get_row_count row 27
08-02 12:50:36.425: D/Cursor(5245): skip_rows row 6
08-02 12:50:36.436: E/CursorWindow(5245): need to grow: mSize = 1048576, size = 69485,
freeSpace() = 9795, numRows = 16

而且应用程序加载速度非常慢。帮助我。

最佳答案

答案是,我们无法在单个 Cursor 中从 sqlite 数据库加载超过 1 MB 的数据。因此必须避免将大数据加载到列表项中。替代解决方案保留较大数据的任何唯一 ID,并通过 onClick List 项将其称为单个数据(对我有用)。

最好的解决方案是使用 CursorJoiner 并点击此链接

how to load more than 1 MB data from sqlite db to android cursor?

Android SQL Lite fail to grow

关于java - ListView内存问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11772741/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com