Glide: Is downloadOnly synchronous or asynchronous?

Created on 31 Dec 2017  路  6Comments  路  Source: bumptech/glide

Consider the following line of code
Glide.with(getContext()).downloadOnly().load(some_uri).submit();

Question 1) Is it synchronous or asynchronous?

Question 2) If it is synchronous, then how do I make it asynchronous? If it is asynchronous, then how do I make it synchronous?

documentation question

All 6 comments

submit() returns a Java Future implementation. submit() is asynchronous.

If you want to make it synchronous, call get() on the returned Future to block until the request completes.

Thanks

@sjudd
It'd be great if the documentation could be updated to reflect the latest proper way to use downloadOnly
It seems the documentation is still referencing the v3 version of downloadOnly functions

@TylerMcCraw the documentation for v4 is here: http://bumptech.github.io/glide/. Can you link to the documentation you're referring to? If it's the wiki, that's expected.

There used to be this entire page of downloading and caching in the background for v3:
https://github.com/bumptech/glide/wiki/Loading-and-Caching-on-Background-Threads

But now, there's only this one snippet of code that hints at it in the v4 documentation and it doesn't even mention how this could be used for caching on a background thread:
http://bumptech.github.io/glide/doc/migrating.html#picking-resource-types

Also, it's never mentioned anywhere in either the javadocs or the v4 documentation that you can't use preload() for caching on background threads, since it requires .into() which checks if we're on the main thread.

Even further, the documentation never mentions how to make asynchronous vs. synchronous calls with the new .download()

I was forced to spend a couple hours drilling into the Glide source code for all of this information, which isn't ideal for users of this library :( , though I love Glide and won't ever use anything else :)

Thanks for the detail. Would you consider using your newfound knowledge to help others by adding a page to the docs site? There's some information on how to contribute docs changes here: http://bumptech.github.io/glide/dev/contributing.html#documentation

Was this page helpful?
0 / 5 - 0 ratings