简体   繁体   中英

Failed to read row 0 sqlitedatabase

How to fix it?

W/CursorWindow: Window is full: requested allocation 2108731 bytes, free space 17752 bytes, window size 2097152 bytes
W/CursorWindow: Window is full: requested allocation 2108731 bytes, free space 2096480 bytes, window size 2097152 bytes
E/CursorWindow: Failed to read row 0, column 0 from a CursorWindow which has 0 rows, 9 columns.

You are storing row data (typically one of the columns contains a media object (eg an image) as a blob) in the database that is too large to be handled by the Cursor. That is an attempt is being made to retrieve 2108731 bytes which is beyond the 2M (2097152 bytes) allocated to a Cursor Window.

You cannot use the android SDK's Cursor methods (without modification) to retrieve such a large amounts of data, even though you can store such an amount.

The fix is to store that data behind the blob (generally images) as a file and to then store a reference to the file (eg it's path or part thereof) in the database.

This link has examples (based on images) and a more comprehensive overview of the issue.

Alternately, this shows a way you could store such an image or images by splitting the data in parts.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM