I did the same a while ago. You must pass the name of the folder where your images match setBaseFolder . This method, in turn, calls refresh() , which - using FilenameFilter (the code is not included, but very simple to implement) gets all the images with the name orig_....jpg from this folder and holds it in mFileList . Then we call notifyDataSetChanged() , which in turn calls getView() for each cell.
Now, in getView() , we either retrieve the bitmap image of the thumbnails from the cache, if we already have it, otherwise we will create a gray placeholder and start creating a ThumbnailBuilder to create thumbnails accordingly. get a bitmap.
I think you will have to change ThumbnailBuilder bit, because I create quite large “thumbnails” (500x500), since I need modified images for other purposes. In addition, when I work with photographs taken by the camera, there is something that rotates the image in accordance with exif information. But basically, ThumbnailBuilder just checks if there is already a miniature image (my thumbnails are placed in one folder, but have the small_ prefix instead of orig_ ) - if the thumbnail already exists, we get it as a Bitmap and executed, otherwise an image is created. Finally, in onPostExecute() bitmap is set to ImageView.
public class PhotoAdapter extends BaseAdapter { private Context mContext; private int mCellSize; private File mFolder; private File[] mFileList; private Map<Object, Bitmap> mThumbnails = new HashMap<Object, Bitmap>(); private Set<Object> mCreatingTriggered = new HashSet<Object>();
source share