Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Universal Image Loader did not apply the displayImageOptions in loadImage

Universal Image Loader did not apply the display image options in the imageLoader.loadImage This is my code

DisplayImageOptions options = new DisplayImageOptions.Builder()
        .showStubImage(R.drawable.loading_image_background)
        .showImageForEmptyUri(R.drawable.ic_launcher)
        .showImageOnFail(R.drawable.loading_image_background)
        .cacheInMemory()
        .cacheOnDisc()
        .bitmapConfig(Bitmap.Config.RGB_565)
        .displayer(new RoundedBitmapDisplayer (20))
        .build();

ImageSize targetSize = new ImageSize(50, 50);
        imageLoader.loadImage(image_poster_url, targetSize, options,
                new SimpleImageLoadingListener() {
                    @Override
                    public void onLoadingComplete(String imageUri,
                            View view, Bitmap loadedImage) {
                        holder.posterImage.setImageBitmap(loadedImage);
                    }
                });

Image is re sized and display perfectly in listview. but the display option(rounded bitmap diplayer)are does not applied to the image. any suggestions?

like image 731
sithmal_ Avatar asked Jun 16 '13 18:06

sithmal_


1 Answers

.displayer(...) is applied only for ImageLoader.displayImage(...) calls. For ImageLoader.loadImage(...) you can use displayers yourself directly:

ImageSize targetSize = new ImageSize(50, 50);
imageLoader.loadImage(image_poster_url, targetSize, options,
            new SimpleImageLoadingListener() {
                @Override
                public void onLoadingComplete(String imageUri,
                        View view, Bitmap loadedImage) {
                    new RoundedBitmapDisplayer(20).display(holder.posterImage);
                }
            });
like image 161
nostra13 Avatar answered Jan 03 '23 12:01

nostra13