Gilad Bar
Gilad Bar

Reputation: 1322

Lazy loading existing contact images in Android

I'm trying to use lazy loading and create a contact list with pre-defined images (the images that are already used for each contact). All I can find is how to use lazy loading to load images from the web, but is there any way I can use it with existing images?

Upvotes: 0

Views: 194

Answers (2)

Laurent Meyer
Laurent Meyer

Reputation: 2881

I don't really know what you call lazy loading but if it is the fact that you load every image independently from the main thread and that you view is displayed asap and that the pictures are coming as soon as they're ready, it's possible. It depends what you use for picture though...

You mentioned contacts pictures, so I guess you could use something like a Loader and are available from API 14.

The answer with Picasso is also working and I guess you can combine a Loader and Picasso and you'd have something totally asynchronous (to get the data as well to display them).

Upvotes: 0

user4617571
user4617571

Reputation:

Use picasso library to lazy loading any image in any storage (SD,Network,etc ...)

add this line to your application gradle build file:

compile 'com.squareup.picasso:picasso:2.5.2'

and now in your code you can do that by some snippet like this :

Picasso.with(context).load(new File(...)).into(imageView3);

check picasso webpage for more example !

Upvotes: 1

Related Questions