android - EXCEPTION DETAILS: java.lang.IllegalStateException: Process 3188 Exceeded cursor quota 100, will kill it with Rom MIUI -
i use code load thumbnail on sdcard, device work good, device use rom miui have problem "exception details: java.lang.illegalstateexception: process 3188 exceeded cursor quota 100, kill it"
please me fix it, thank you.
public static bitmap getthumbnailbypath(contentresolver cr, string path) throws exception { string[] projection = { mediastore.images.media._id }; cursor cursor = cr.query(mediastore.images.media.external_content_uri, projection, mediastore.images.media.data + "=?", new string[] { path }, null); if (cursor != null && cursor.movetofirst()) { long id = cursor.getlong(0); return getthumbnailbyid(cr, id); } else cursor.close(); return null; } public static bitmap getthumbnailbyid(contentresolver cr, long idphoto) throws exception { return mediastore.images.thumbnails.getthumbnail(cr, idphoto, mediastore.images.thumbnails.mini_kind, options); }
you must always close cursors.
use this:
cursor cursor = ...; try { if (cursor.movetofirst()) return getthumbnailbyid(cr, cursor.getlong(0)); else return null; } { cursor.close(); }
Comments
Post a Comment