3

このコードを使用して Sdcard にサムネイルをロードします。デバイスは正常に動作しますが、MIUI でデバイスを使用すると、「例外の詳細: java.lang.IllegalStateException: プロセス 3188 がカーソル クォータ 100 を超えたため、それを強制終了します」という問題が発生します。

修正を手伝ってください、ありがとう。

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);
}
4

1 に答える 1