JustPaste.it

async void downloadAsync(Uri url, ImageView imageview)
{
webClient = new WebClient ();
byte[] bytes = null;

try{
bytes = await webClient.DownloadDataTaskAsync(url);
}
catch(TaskCanceledException){
Console.WriteLine ("Task Canceled!");
return;
}
catch(Exception e){
Console.WriteLine (e.ToString());
return;
}

// "Resizing Image...";
BitmapFactory.Options options = new BitmapFactory.Options ();
options.InJustDecodeBounds = true;
BitmapFactory.DecodeByteArray(bytes, 0, bytes.Length, options);

options.InSampleSize = options.OutWidth > options.OutHeight ? options.OutHeight / imageview.Height : options.OutWidth / imageview.Width;
options.InJustDecodeBounds = false;

Bitmap bitmap = BitmapFactory.DecodeByteArray(bytes, 0, bytes.Length, options);

Console.WriteLine ("Loaded!");

imageview.SetImageBitmap (bitmap);

application.memoryCache.Put (url.ToString(), bitmap);
}