开发者

How to display _only specific_ images from SD card in a GalleryView?

开发者 https://www.devze.com 2023-02-08 07:41 出处:网络
Following the guide at http://mihaifonoage.blogspot.com/2009/09/displaying-images-from-sd-card-in.html, how can I show only image files following a pattern [EDIT] in a Gallery widget [/EDIT]? I\'m usi

Following the guide at http://mihaifonoage.blogspot.com/2009/09/displaying-images-from-sd-card-in.html, how can I show only image files following a pattern [EDIT] in a Gallery widget [/EDIT]? I'm using a dedicated directory on the sdcard and I have to use the following filename pattern to store images:

/sdcard/[MYDIRECTORY]/[APPNAME]_[AN-ID]_[ANOTHER-ID]_[DATE].jpg

Now, I'd like to show only those pictures where [AN-ID] == x.

I believe that I have to manipulate the ContentResolver, but I have no idea how to do th开发者_如何转开发is. I know it would be much easier to just save all associated pictures in a single folder, but I'm not able to do this.


For that you have to do this modification to above link code:


Uri uri=Uri.withAppendedPath(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,""+imagename); cursor = managedQuery( uri, projection, // Which columns to return null, // Return all rows null, null);

0

精彩评论

暂无评论...
验证码 换一张
取 消