【问题标题】:Android MediaStore Thumbnails doesn't existsAndroid MediaStore 缩略图不存在
【发布时间】:2014-10-30 03:21:38
【问题描述】:

我正在尝试使用 MediaStore 来获取手机/平板电脑中的所有图像。我成功了。

 String[] projection = new String[]{
            MediaStore.Images.Media.DATA,
            MediaStore.Images.Media.BUCKET_DISPLAY_NAME
    };
 Uri images = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
 Cursor cur = activity.getContentResolver().query(images,
            projection, // Which columns to return
            "",         // Which rows to return (all rows)
            null,       // Selection arguments (none)
            ""          // Ordering
    );
 if (cur.moveToFirst()) {
     String photo;
     String album;
     int bucketColumn = cur.getColumnIndex(MediaStore.Images.Media.BUCKET_DISPLAY_NAME);
     int photoColumn = cur.getColumnIndex(MediaStore.Images.Media.DATA);
     album = cur.getString(bucketColumn);
     photo = cur.getString(photoColumn);
 }//Just parts of code

我想用从 MediaStore 获得的图像创建 GridView。


问题是当有很多图片时会出现一些问题。我使用通用图像加载器,所以它没问题,但我需要它非常快,所以我发现 Android 应该有他自己的图片缩略图存储在 MediaStore.Images.Thumbnail 中,所以我不必创建自己的缩略图。

Get thumbnail Uri/path of the image stored in sd card + android

似乎也不起作用。我查看了设备的外部数据库,什么都没有。

【问题讨论】:

    标签: java android thumbnails android-gridview mediastore


    【解决方案1】:

    看看 Lucas Rochas 冰沙库。这个库实现了快速滚动网格。我在我的播放列表管理器(谷歌播放)上使用它。 http://lucasr.org/2013/01/06/introducing-smoothie/

    【讨论】:

    • 谢谢你的回答,但我得到的却很困难。我必须将图像放到网格视图中,并且这些图像必须按拍摄日期(StickyGridHeader)进行排序,并且在其中我必须设置图片。现在我正在使用通用图像加载器,但它会加载完整的图像。这只是说我需要在哪里使用它,遗憾的是我知道 Smoothie 不能这样做。
    • 如果您想加载图像,调整大小以使其适合您的网格,并且快速滚动,冰沙库将为您完成。排序与显示无关,因为您的查询应提供按要求排序的光标。
    猜你喜欢
    • 1970-01-01
    • 2018-03-11
    • 2015-04-20
    • 2015-04-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多