3

In order to implement image pre-fetching, we get the ImagePipeline and call prefetchToBitmapCache on it. however, both the API Javadoc (http://frescolib.org/javadoc/reference/com/facebook/imagepipeline/core/ImagePipeline.html#prefetchToBitmapCache(com.facebook.imagepipeline.request.ImageRequest, java.lang.Object) and the plain doc (http://frescolib.org/docs/using-image-pipeline.html#) are incorrect. specifically , they leave out the description and example for what the second method parameter is. I am talking about the Object callerContext . which since its an object isn't an android Context. I'm guessing that because the type is an object, not a Context. Could the documentation be updated and/or someone explain what the caller context is supposed to be? Thank you!

yrizk
  • 394
  • 2
  • 8

1 Answers1

2

So I posted this question a while back on the fresco github (https://github.com/facebook/fresco/issues/609) and I was told the documentation would be updated. I'm posting my results here since it is likely others might look here. I still haven't seen any updates to frescolib.org or anywhere else. I decided to figure it out myself. Basically, if you're using SimpleDraweeView and its respective ImageRequest (which the prefetch call needs) , then you would notice that setting the uri on the view creates a DraweeController with a null callerContext. I figured that might be what is needed here. Sure enough, I made the call to prefetchToBitmapCache(draweeController, null) and its prefetched! I know that because I waited for a bit and turned off the data. also this call was only active on a select imageview. the other did not load. I can't be sure this is the right way to do it, ntil they come out with the right documentation. but like i said it works.

yrizk
  • 394
  • 2
  • 8
  • One of the maintainers issued a PR to address this 2 weeks ago https://github.com/facebook/fresco/pull/610/files. – ataulm Sep 28 '15 at 20:07
  • Interesting. I checked yesterday at frescolib.org and it wasn't updated. Specifically, this part of the docs (http://frescolib.org/docs/using-image-pipeline.html#_) at the bottom of the page still shows the wrong function call. That's why I thought the update had not happened yet. – yrizk Sep 29 '15 at 13:48
  • Oy, this is unsettling. I'm not comfortable passing null here - what if something in fresco or otherwise tries to access callerContext? Has ANYBODY figured out what the correct object to pass in here is? – Aphex Nov 16 '16 at 23:53