Interesting. According to that little discussion the database file read 
operation is interrupted. SQLite gets less bytes to read from the database 
file than requested.

Well in that case I wonder whether the media file scanner has something to 
do with that. I think it's possible that the scanner randomly kicks in on 
your device and interrupts any database read access while it is scanning 
for updated media files. Does your app trigger a media scan?

In any case I think you should simply catch that specific error and also 
check whether the media scanner is currently 
running<http://stackoverflow.com/questions/12136681/detect-if-media-scanner-running-on-android>.
 
As soon as the scanner has finished you can retry querying the 
MediaProvider.



On Wednesday, January 9, 2013 10:15:48 AM UTC-6, Kostya Vasilyev wrote:
>
> http://comments.gmane.org/gmane.comp.db.sqlite.general/69438 
>
> 2013/1/9 ironox <[email protected] <javascript:>>: 
> > it happen only on one device。 
> > 
> > this device 's storage is very special,, 
> > 
> > it has two storage ,,sdcard is mounted under /storage/sdcard0 , internal 
> > storage for users is mounted under /storage/sdcard0/external_sd 
> > 
> > when sdcard is removed , internal storage for users is mounted under 
> > /storage/sdcard0 
> > 
> > 
> > On Wednesday, January 9, 2013 12:51:51 AM UTC+8, Nobu Games wrote: 
> >> 
> >> The documentation of that exception says: 
> >> 
> >> /** 
> >>  * An exception that indicates that an IO error occured while accessing 
> >> the 
> >>  * SQLite database file. 
> >>  */ 
> >> 
> >> Which might be an indication for the following scenarios: 
> >> 
> >> Disk is full 
> >> Disk is corrupt 
> >> File system is corrupt 
> >> File does not exist 
> >> File is a directory 
> >> No read / write permissions 
> >> 
> >> Does it happen on all your test devices? 
> >> 
> >> 
> >> On Monday, January 7, 2013 8:13:37 PM UTC-6, ironox wrote: 
> >>> 
> >>> i am working on android 4.1. 
> >>> 
> >>> recently i consequently get the 
> >>> android.database.sqlite.SQLiteDiskIOException: disk I/O error (code 
> 522) 
> >>> 
> >>> it is a random thing,  but only happened in the apps that used 
> >>> MediaProvider! 
> >>> 
> >>> Caused by: android.database.sqlite.SQLiteDiskIOException: disk I/O 
> error 
> >>> (code 522) 
> >>>         at 
> >>> 
> android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:182)
>  
>
> >>>         at 
> >>> 
> android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:140)
>  
>
> >>>         at 
> >>> 
> android.content.ContentProviderProxy.query(ContentProviderNative.java:366) 
> >>>         at 
> >>> android.content.ContentResolver.query(ContentResolver.java:371) 
> >>>         at 
> >>> android.content.ContentResolver.query(ContentResolver.java:314) 
> >>> 
> >>> can anyone give me some hint? it is blocking me  for 3 weeks ..... 
> >>> 
> > -- 
> > You received this message because you are subscribed to the Google 
> > Groups "Android Developers" group. 
> > To post to this group, send email to 
> > [email protected]<javascript:> 
> > To unsubscribe from this group, send email to 
> > [email protected] <javascript:> 
> > For more options, visit this group at 
> > http://groups.google.com/group/android-developers?hl=en 
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to