Modest User
Modest User

Reputation: 3

Android - Does Glide image loading and caching library handle images Asynchronously?

I would like to know if Glide handles image loading asynchronously or do I have to use AsyncTask myself to handle the impact on the main thread?

I just need better clarification on this so that whenever I decide to load images into for arguments sake, a RecyclerView I can know for sure that Glide is just as good to use as Picasso (Where asynchronous media handling is concerned).

I do know that Picasso loads images asynchronously but does Glide?

Upvotes: 0

Views: 1736

Answers (2)

Gene
Gene

Reputation: 11267

I'm more familiar with volley but I took at look at Glide for you. It seems like there's a cache, so the answer should be yes, Glide should load your image asynchronously. You do not have to handle the impact on your main thread.

The cache will load and store your images for you. For valley, the code is as simple as:

ImageLoader imageLoader = AppController.getInstance().getImageLoader();

// thumbnail image
NetworkImageView thumbNail = (NetworkImageView) view.findViewById(R.id.thumbnail);
thumbNail.setImageUrl(posterURL, imageLoader);

ImageLoader object probably has the cache which loads and holds the images.

Upvotes: 2

Guillaume Imbert
Guillaume Imbert

Reputation: 496

Yes it does. Glide's API is the same as Picasso's one, and their implementations are also nearly the same (their difference is mainly in their cache implementation)

Upvotes: 1

Related Questions