0

I'm trying to load image from mobile. Same method with picasso is working fine but i get problem using FFImageloading

var CatalogCategories = System.IO.Path.Combine(Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryPictures).ToString(), "dbsoft");
ImageService.Instance.LoadFile(new Java.IO.File(CatalogCategories, "Main.jpg")).Into(MainImage);

I getting Error CS1503 Argument 1: cannot convert from 'Java.IO.File' to 'string'

testsc
  • 71
  • 7

1 Answers1

0

The LoadFile method's parameter should be string.

/// <summary>
/// Constructs a new TaskParameter to load an image from a file.
/// </summary>
/// <returns>The new TaskParameter.</returns>
/// <param name="filepath">Path to the file.</param>
TaskParameter LoadFile(string filepath);

You need use File's AbsolutePath property to get the string path:

ImageService.Instance.LoadFile(new Java.IO.File(CatalogCategories, "Main.jpg").AbsolutePath).Into(MainImage);

Update

The Into method's parameter should be ImageViewAsync, so you should use ImageViewAsync in your layout:

<FFImageLoading.Views.ImageViewAsync
    android:id="@+id/mainImage"
    android:scaleType="centerCrop"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

In your .cs file:

ImageViewAsync MainImage = FindViewById<ImageViewAsync>(Resource.Id.mainImage);
Robbit
  • 4,300
  • 1
  • 13
  • 29
  • Severity Code Description Project File Line Suppression State Error CS1503 Argument 2: cannot convert from 'Android.Widget.ImageView' to 'FFImageLoading.Views.ImageViewAsync' – testsc Apr 23 '18 at 20:27