スナックelve 本店

バツイチ40代女の日記です

No.1239 お、できた c# urlから画像を読み込んでBitmapに xamarin

昨日からはまってた。URLからさくっと画像表示できるないものか悩んでいた。(アイコンの表示)
英語の掲示板のソースコピペしたらできた!!


f:id:elve:20170509202204p:plain:h400


うへへへへ(*´▽`*)

private Bitmap GetImageBitmapFromUrl(string url)
{
Bitmap imageBitmap = null;

using (var webClient = new WebClient())
{
var imageBytes = webClient.DownloadData(url);
if (imageBytes != null && imageBytes.Length > 0)
{
imageBitmap = BitmapFactory.DecodeByteArray(imageBytes, 0, imageBytes.Length);
}
}

return imageBitmap;
}

https://forums.xamarin.com/discussion/4323/image-from-url-in-imageview

これこのまま使った(わかってない)