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);
精彩评论