I am trying to set background for the image view. But not got luck to set background using universal image loader.
I am using following code.
DisplayImageOptions options = new DisplayImageOptions.Builder()
.showStubImage(R.drawable.mo_no_image)
.showImageForEmptyUri(R.drawable.mo_no_image)
.cacheInMemory().cacheOnDisc()
.displayer(new RoundedBitmapDisplayer(0))
.imageScaleType(ImageScaleType.EXACTLY).build();
ImageLoader.getInstance().displayImage("url_to_load_image", imgView, options);
By using above code I am able to set image resource which check aspect ratio and using that modifying image size. I want to set downloaded image to the background of image view.
Universal Image Loader also provide to use the Background functionality.Please check the below coed for it:-
Here Uri is the path of the folder image OR the url of the image.
I can recommend a different way that works like a charm: Android Query.
You can download that jar file from http://code.google.com/p/android-query/downloads/list
As an example:
It's very fast and accurate, and using this you can find many more features like Animation when loading; getting a bitmap, if needed; etc.
In your case you need to fetch Bitmap, so for it, use below code
Use this bitmap to set your background resource of ImageView using method.