Load multiple images in ImageView - android

I have a grid view which shows some images loaded from a server. I use Universal image loader to load the images in the imageView. the problem is it takes time to load those images and I don't want their places to be empty. I want to show an image which is located in the assets of the app and then load the images from server on top of it.
I wanted to ask if you have any solutions to this problem.Thanks very much

Very generic way to use DisplayImageOptions is as
DisplayImageOptions displayImageOptions = new DisplayImageOptions.Builder()
.showImageOnLoading(R.drawable.placeholder_image).showImageForEmptyUri(0)
.resetViewBeforeLoading(true).cacheInMemory(true).cacheOnDisk(true)
.imageScaleType(ImageScaleType.IN_SAMPLE_INT).bitmapConfig(Bitmap.Config.RGB_565)
.delayBeforeLoading(100).displayer(new FadeInBitmapDisplayer(500)).build();
Here showImageOnLoading(R.drawable.placeholder_image) method is used to display a placeholder image until the real image is loaded. R.drawable.placeholder_image is the drawable you want to show as placeholder.

Related

How to show Glide images when ready? They are shown incorrectly if not fully downloaded

I am working on an application that has this image gallery activity where images are loaded from disk using Glide. These images are downloaded separately through DownloadManager. The problem is that these images might not have been downloaded by the time the user opens the gallery. I guess one way would be to load these images dynamically once each file gets downloaded by going through a BroadcastReceiver but I am wondering if there is an easier solution? Some of the images only shows parts of itself while others don't show at all, and in order to view the full images I have to navigate back into the gallery so that Glide can redo the loading. I would instead like the images to be displayed once they are able to load. I also tried using a placeholder but it will never be replaced by the image (I would also like to avoid using a placeholder image since I don't have any). The images are displayed in a GridView and loaded in getView method of a BaseAdapter. (Currently I also have to avoid storing the images in cache otherwise the incomplete images will be shown the next time as well). Code:
val file = File(urls[position].toString())
Glide.with(context)
.asBitmap()
.load(file)
.diskCacheStrategy(DiskCacheStrategy.NONE)
.skipMemoryCache(true)
.fitCenter()
.apply(RequestOptions())
.into(imageView)

Android - Using Picasso in order to load an image for a game?

I have used both Picasso and Glide in order to load images asyncronously in grids with images coming from the phone's external memory and in order to download photos from the Internet.
But now for my Android game in the first screen I need to display an image below a title (the image takes up all available height). Then the user taps on a specific part of the image and the game starts.
The image content is a drawable resource.
So, for this specific use (a TextView and an ImageView below it which takes up all the remaining space), what should I do:
-Specify the image as ImageView's src property.
-Use an image loading library, such as Picasso or Glide
What do you suggest and why?
Thank you.
EDIT: The image would be static, a static drawable resource.

Universal Image Loader images with big resolution

I using universal image loader to load images from gallery to listView and i have a problem with big images when scrolling images with bigger resolution loads slower than images with lower resolution i quess it should be like that but is there any way to load them in same speed?
options = new DisplayImageOptions.Builder()
.imageScaleType(ImageScaleType.IN_SAMPLE_POWER_OF_2)
.resetViewBeforeLoading(false)
.cacheInMemory(false)
.cacheOnDisk(false)
.build();``
code above doesnt fix this problem.
Try to preload those images which need to be shown in the next listView's items.

Loading Sign before downloading Image and Setting Image on Image View

I have a listView in which I have text and an image view Now the data is coming from the service in this case text is of some bytes but due to images size imageview populate after some time . for this I want to show loading symbol in in imageview so that in time of downloading user not say that the app is not able to show images. I have implemented all listActivity and adapters concepts and its working fine but the images take time due to which the imageview part shows black area . any help
Here this I want:
In Android we called it lazy list..
this will help you to understood..
1.Lazy loading of images in ListView
2.http://www.technotalkative.com/android-asynchronous-image-loading-in-listview/
For Image issue :
Change in ImageLoader class (if Using Lazy List)
final int stub_id=R.drawable.ic_launcher; //change it to process image
Good Luck
Place a ProgressBar and keep the imageView over the ProgressBar.So the progress bar is visible when there is no image in the image view. Also use lazyList to load image.
You might want to check out Android Query. it's a library that also supports Asynchronous image loading and caching.
Android

Adding an image for faild downloads in universal image loader

In my monodroid application I use universal image loader to display images on a list view .
Before displaying images i show a progress bar on images.
I wanna add an default images for when the download fails.
Is it possible?
This is the code that i display image with it:
ImageLoader = Com.Nostra13.Universalimageloader.Core.ImageLoader.Instance;
ImageLoader.DisplayImage(myobject.Images [0], imageView, Application.Options, newImageLoaderListener (progressbar));
This is a monodroid code.
Thanks.
Use ImageLoadingListener.onLoadingFailed() for that. Display your image in onLoadingFailed().

Categories

Resources