Android:光标窗口已满 [英] Android: Cursor Window is full
问题描述
W/CursorWindow(15677):窗口已满:请求分配 2195889字节,可用空间 2096720 字节,窗口大小 2097152 字节
W/CursorWindow(15677): Window is full: requested allocation 2195889 bytes, free space 2096720 bytes, window size 2097152 bytes
我知道有可用的应用内存:
I know there is app memory avaliable:
D/dalvikvm(15677):GC_FOR_ALLOC 释放 9K,30% 释放 17050K/24291K,暂停 45 毫秒
D/dalvikvm(15677): GC_FOR_ALLOC freed 9K, 30% free 17050K/24291K, paused 45ms
所以它纯粹与光标大小窗口有关,当将 blob
读入 byte[]
时.
So its purely to do with the cursor size window, when Reading blob
into byte[]
.
我使用内置方法从游标读取 blob.
Im using the built in method to read blobs from a cursor.
try
{
c = rdb.query("Photos", new String[]{"photo"}, "id = ?", new String[]{""+photoID}, null, null, null);
if(c.moveToFirst())
{
byte[] tArray = c.getBlob(c.getColumnIndex("photo")); // THIS LINE ERRORS
}
}catch(Exception e)
{
e.printStackTrace();
}
c.close();
return tArray;
有没有办法解决这个问题?窗口大小似乎被限制为 2097152 字节.
Is there a way around this? The window size seems to be limited to 2097152 bytes.
推荐答案
看来解决这个问题的最好方法是将 Photo 存储在 SDCard 上,并将 URI 保存在 DB 中.
It seems that the best way around this is to store the Photo on the SDCard, and save the URI in the DB.
虽然我想避免这种情况,但还不错,而且更稳定.
While I wanted to avoid this, it's not too bad, and is much more stable.
这篇关于Android:光标窗口已满的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!