Using a monodroid java bindings project of Android Universal Image Library, how would I translate this from java to .net? Can I pass it in a lambda for the loading listener?
The Java code example
// Load image, decode it to Bitmap and return Bitmap to callback
imageLoader.loadImage(imageUri, new SimpleImageLoadingListener() {
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
hideSpinner();
//do I set the image view to the view we get back here?
}
});
.NET ?
ImageLoader.Instance.LoadImage(imageUri, ... can I put a lambda in here or do I have to
C# does not support anonymous classes with Interface implementations, such can only implement public read-only properties. So you will have to create a class, which implements the SimpleImageLoadingListener
.
Something in the lines of:
public class MySimpleImageLoadingListener : SimpleImageLoadingListener
{
public override void OnLoadingComplete(String imageUri, View view, Bitmap loadedImage)
{
//Do whatever you need in here.
}
}
Then you have to create an instance and pass it to LoadImage()
:
ImageLoader.Instance.LoadImage(imageUri, new MySimpleImageLoadingListener());