private void AddLastKitchenInformation(string userName) { var lastKitchenInfo = GetLastDayKitchenInfo(userName); if (lastKitchenInfo != null) { TableLayout.LayoutParams layoutParameters = new TableLayout.LayoutParams( TableLayout.LayoutParams.MatchParent, TableLayout.LayoutParams.WrapContent); layoutParameters.SetMargins(5, 5, 5, 5); layoutParameters.Weight = 1; SetTableHeader(layoutParameters); foreach (var lki in lastKitchenInfo) { TableRow tr = new TableRow(this); tr.LayoutParameters = layoutParameters; TextView site = new TextView(this); site.Text = lki.SiteName; tr.AddView(site); TextView space1 = new TextView(this); space1.Text = " "; tr.AddView(space1); TextView plotNo = new TextView(this); plotNo.Text = lki.PlotNumber; tr.AddView(plotNo); TextView space2 = new TextView(this); space2.Text = " "; tr.AddView(space2); TextView kitchenModel = new TextView(this); kitchenModel.Text = lki.KitchenModel.ToString(); tr.AddView(kitchenModel); TextView space3 = new TextView(this); space3.Text = " "; tr.AddView(space3); TextView imgNo = new TextView(this); imgNo.Text = lki.ImageNumber.ToString() + (lki.ImageNumber == 1 ? "pic" : "pics"); tr.AddView(imgNo); table.AddView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.MatchParent, TableLayout.LayoutParams.WrapContent)); } // getting last kitchen images HttpWebRequest request = WebRequest.Create(Constant.STORAGE_URL + "/lastKitchenImages") as HttpWebRequest; request.Headers.Add("Authorization", "Bearer " + accessToken); HttpWebResponse response = request.GetResponse() as HttpWebResponse; if (response.StatusCode == HttpStatusCode.OK) { Stream responseStream = response.GetResponseStream(); StreamReader reader = new StreamReader(responseStream); var responseFromServer = reader.ReadToEnd(); List <ImageViewModel> images = JsonConvert.DeserializeObject <List <ImageViewModel> >(responseFromServer); CloudStorageAccount account = StorageHelpers.StorageAccount(accessToken); CloudBlobClient blobClient = account.CreateCloudBlobClient(); CloudBlobContainer container = blobClient.GetContainerReference(Constant.IMAGE_STORAGE_CONTAINER_NAME); Bitmap[] bitmaps = new Bitmap[images.Count]; int position = 0; foreach (var image in images) { using (MemoryStream ms = new MemoryStream()) { CloudBlockBlob blockBlob = container.GetBlockBlobReference(image.Name); blockBlob.DownloadToStream(ms); byte[] data = ms.ToArray(); bitmaps[position] = BitmapHelpers.DecodeSampledBitmapFromByteArray(data, 100, 100); } position++; } var gridView = FindViewById <GridView>(Resource.Id.gridView1); gridView.Adapter = new ImageAdapter(this, bitmaps); } } }