有没有什么办法来寻找使用路径的形象呢? MediaStore.Images.Thumbnails(安卓) [英] Is there any way to look for an image using the path? MediaStore.Images.Thumbnails (Android)

查看:514
本文介绍了有没有什么办法来寻找使用路径的形象呢? MediaStore.Images.Thumbnails(安卓)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为了使用 MediaStore.Images.Thumbnails 显示用户有自己的设计。但我不能够通过它的路径来获得图像。 有没有办法使用的路径,寻找一个形象?

I'm using MediaStore.Images.Thumbnails in order to show the images the user have. But i'm not able to get an image through its path. Is there any way to look for an image using the path?

String [] proj={MediaStore.Images.Thumbnails._ID, MediaStore.Images.Thumbnails.IMAGE_ID, MediaStore.Images.Media.DATA};  
String selection =  MediaStore.Images.Media.DATA + " like '%path%'";  //this doesn't work  
cursor = managedQuery( MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI,
                       proj, // Which columns to return   
                       selection,       // WHERE clause;   
                       null,        
                       null); // Order-by clause 

祝商祺!

推荐答案

EDITED

您好,

//I just get Image ID.

String [] proj={MediaStore.Image.Media._ID,MediaStore.Image.Media.DATA}
cursor=manageQuery(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, proj,MediaStore.Images.Media.DATA+"= ' "+path+" ' ",null,null);
cursor.moveToFirst();

// and then, use ID to get thumbnails

Bitmap b=MediaStore.Images.Thumbnails.getThumbnail(cr,Integer.valueOf(cursor.getString(0)),kind, null);

// or for video

Bitmap b=MediaStore.Video.Thumbnails.getThumbnail(cr, Integer.valueOf(cursor.getString(0)),kind, null);

BR, 杰特

BR, Jett

这篇关于有没有什么办法来寻找使用路径的形象呢? MediaStore.Images.Thumbnails(安卓)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆