Android API - luberda-molinet/FFImageLoading GitHub Wiki
ProGuard configuration file
If you experience any problems add this to ProGuard configuration file:
-keep class ffimageloading.cross.** { *; }
-keep class FFImageLoading.** { *; }
Transparency
By default, on Android, images are loaded without transparency channel. This allows saving 50% of memory since 1 pixel uses 2 bytes instead of 4 bytes in RGBA. This is overridable for all images using ImageService.Instance.Initialize(loadWithTransparencyChannel:true)
or, per image request, by explicitly setting TaskParameter.TransparencyChannel(true or false)
.
Source
On Android images can be loaded from Internet, Resources, Assets or File.
Internet
When the image is loaded from internet the image is cached on disk (by default 30 days but there is an optional TimeSpan so you can choose yours).
ImageService.Instance.LoadUrl(urlToImage).Into(_imageView);
Resources
If you don't know what are resources you can read Xamarin resources documentation.
ImageService.Instance.LoadCompiledResource(nameOfResource).Into(_imageView);
Assets
If you don't know what are assets you can read Xamarin asset documentation.
ImageService.Instance.LoadFileFromApplicationBundle(fullPathToImage).Into(_imageView);
File
When you want to load the image from a file:
ImageService.Instance.LoadFile(fullPathToImage).Into(_imageView);
Stream
The image can be loaded from an existing Stream. Pleas note: In this case the image is only cached in memory when custom key is provided. Please note that the Stream is automatically closed.
ImageService.Instance.LoadStream((token) => { return SomeMethodWhichReturnsStream(token); }).Into(_imageView);