4

The FFImageLoading Xamarin Android/iOS image loading library is working fantastic in a custom list by using the following in the BaseAdapter derived class' overriden GetView:

ImageViewAsync imageViewAsync = view.FindViewById<ImageViewAsync>(Resource.Id.Image);
ImageService.LoadUrl(item.ImagePoster).Into(imageViewAsync);

The problem is that when scrolling down the Android ListView it takes too long to download each image and so I'd like to preload some or all the images in the list to make for a better user experience.

So can I preload images with FFImageLoading without loading into an ImageViewAsync?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Tarostar
  • 1,196
  • 1
  • 15
  • 27

3 Answers3

2

FFImageLoading latest alpha nuget package provides a Preload() method:

https://github.com/molinch/FFImageLoading/blob/master/source/FFImageLoading.Droid/TaskParameterExtensions.cs

Fabien
  • 1,015
  • 2
  • 11
  • 22
1

https://github.com/luberda-molinet/FFImageLoading/wiki/API#preload

// In this example urlToImage will be added to cache without being assigned to any target. ImageService.Instance.LoadUrl(urlToImage).Preload();

Please use latest version of FFImageLoading.

Harshadcse
  • 225
  • 1
  • 9
0

Even better an awaitable:

ImageService.Instance.LoadUrl(url, new TimeSpan(365, 0, 0)).Preload().RunAsync();

Nick Kovalsky
  • 5,378
  • 2
  • 23
  • 50