android - Loading Images for gallery from Custom folder -
i trying load images , show them gallery in form of list. problem able default android gallery, don't know how t custom folder. e.g /pictures folder. have been trying, here code use default gallery, want other folder, e.g /pictures/col.
public static list<photoitem> getalbumthumbnails(context context){ final string[] projection = {mediastore.images.thumbnails.data, mediastore.images.thumbnails.image_id}; cursor thumbnailscursor = context.getcontentresolver().query( mediastore.images.thumbnails.external_content_uri, projection, // columns return null, // return rows null, null); // extract proper column thumbnails int thumbnailcolumnindex = thumbnailscursor.getcolumnindex(mediastore.images.thumbnails.data); arraylist<photoitem> result = new arraylist<photoitem>(thumbnailscursor.getcount()); if (thumbnailscursor.movetofirst()) { { // generate tiny thumbnail version. int thumbnailimageid = thumbnailscursor.getint(thumbnailcolumnindex); string thumbnailpath = thumbnailscursor.getstring(thumbnailimageid); uri thumbnailuri = uri.parse(thumbnailpath); uri fullimageuri = uritofullimage(thumbnailscursor,context); // create list item. photoitem newitem = new photoitem(thumbnailuri,fullimageuri); result.add(newitem); } while (thumbnailscursor.movetonext()); } thumbnailscursor.close(); return result; }
what should change here, tried change projection, query parameters failed, new in field, please :)
you can custom recent-images library purpose. it's simple , easy use library.
Comments
Post a Comment