public void listfiles(Activity act, File[] files) {
ArrayList<HashMap<String, Object>> lstImageItem = new ArrayList<HashMap<String, Object>>();
List<File> fileList = new ArrayList<File>();
for (File file : files) {
HashMap<String, Object> map = new HashMap<String, Object>();
String thumbnail_path = null;
// get the thumbnail of the given picture
String[] projection2 = { "_id" }; // "_data"
System.out.println("s");
Uri uri2 = MediaStore.Images.Media.getContentUri("external");
System.out.println("huhuhuhuhu" + file.getPath());
String where = String.format("_data='%s'", "/mnt" + file.getPath());
System.out.println(where);
Cursor c2 = Media.query(act.getContentResolver(), uri2,
projection2, where, null);
if (c2.moveToFirst()) {
do {
long image_id = c2.getLong(c2.getColumnIndexOrThrow("_id"));
System.out.println("------------------>" + image_id);
String[] projection = { "_data" };
Cursor c = Thumbnails.queryMiniThumbnail(
act.getContentResolver(), image_id,
Thumbnails.MINI_KIND, projection);
if (c.moveToFirst()) {
do {
thumbnail_path = c.getString(c
.getColumnIndexOrThrow("_data"));
System.out.println("------------------>"
+ thumbnail_path);
} while (c.moveToNext());
}
// do some stuff
} while (c2.moveToNext());
}
map.put("ItemImage", thumbnail_path);// 添加图像资源的ID
// map.put("ItemText", "默认相册" + file.getName());// 按序号做ItemText
lstImageItem.add(map);
fileList.add(file);
}
}
分享到:
相关推荐
jQuery thumbnail 惟美的图片Tip提示效果,鼠标放到每一个格子上面,立即变换成文字,提示图片的内容,一时半会还不知如何形容这种效果,自己下载看吧。
读取文件夹下图片生成略缩图并点击显示大图
jQuery thumbnail 惟美的图片Tip提示效果 jQuery thumbnail 惟美的图片Tip提示效果
BlurImageView For Android, you can load your image progressively like Medium. How it works? First it will show user a blurry image; At the same time, it starts to load the real image; once loaded, ...
Android图片框架Glide-3.7.0(最新,很强大),超好用的图片框架(包含jar和源码) Glide 是一个高效、开源、 Android设备上的媒体管理框架,它遵循BSD、MIT以及Apache 2.0协议发布。Glide具有获取、解码和展示视频...
前端项目-lg-thumbnail,LightGallery的缩略图模块。
帮你快速的建立HTML网页相簿或图库,提供了基本的设置和HTML的模板,但你也可以自己修改版面,建立自己的模板,完成后就可以导出HTML文件,支持各种图像格式(jpg,gif,tiff,bmp,png等)。
方便查看thumbs.db. ehthumbs.db, thumbcache_*.db files等缩略图文件的源代码
今天我们要给大家介绍一款相对比较实用的jQuery焦点图插件,这款焦点图插件的特点有2个,一个是每一张图片都有一个同比例尺寸的缩略图,所有缩略图都排列在下方,点击缩略图即可切换到对应的图片;另外一个特点是...
Exif缩略图添加器这是一个适用于android设备的应用程序,它将在您的设备上搜索图片(JPEG),如果还没有缩略图,则在EXIF标签中添加缩略图。 它应该可以在android Oreo(android 8,SDK 26)上运行,并且已经在运行...
DDS_viewer(DDS文件在windows下显示缩略图的补丁
react-native-create-thumbnail是 (iOS)和 (Android)的包装 入门 从npm安装库 npm i react-native-create-thumbnail 或者 yarn add react-native-create-thumbnail 链接本机代码 带有自动链接(React本机0.60...
thumbnail.db-shm
Laravel开发-thumbnail 视频缩略图
thumbnail.db-wal
抽象来说,它是计算机系统结构,或称计算机体系结构,是一个系统在其所处环境中最高层次的概念;它确定一台计算机硬件和软件之间的衔接。具体地说计算机体系结构指的是计算机系统设计的观念与架构,描述计算机在实做...
Windows 下获取屏幕和窗口的缩略图,并使用 DuiLib 显示出来
以缩略图的形式在Windows资源浏览器中显示自定义格式图片