Exemplo n.º 1
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            try
            {
                ViewHolderAutoComplete holder;
                View row = convertView;
                if (row == null)
                {
                    row                 = LayoutInflater.From(context).Inflate(Resource.Layout.AutocompleteRow, null, false);
                    holder              = new ViewHolderAutoComplete();
                    holder.imageView    = row.FindViewById <ImageView>(Resource.Id.ImageAutocomplete);
                    holder.nameTextView = row.FindViewById <TextView>(Resource.Id.NameTextView);
                    holder.typeTextView = row.FindViewById <TextView>(Resource.Id.TypeTextView);
                    row.Tag             = holder;
                }
                else
                {
                    holder = row.Tag as ViewHolderAutoComplete;
                }

                holder.typeTextView.Text = this.autocompleteSearches[position].ResultType;
                holder.nameTextView.Text = this.autocompleteSearches[position].Name;
                //holder.imageView.SetImageBitmap(GetImageBitmapFromUrl(this.autocompleteSearches[position].PicUrl));
                if (autoCompleteImages.ContainsKey(this.autocompleteSearches[position].PicUrl))
                {
                    holder.imageView.SetImageBitmap(autoCompleteImages[this.autocompleteSearches[position].PicUrl]);
                }
                else
                {
                    this.UpdateImage(holder, position);
                }
                return(row);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Exemplo n.º 2
0
        private async void UpdateImage(ViewHolderAutoComplete holder, int position)
        {
            autoCompleteImages[this.autocompleteSearches[position].PicUrl] = await GetImageBitmapFromUrl(this.autocompleteSearches[position].PicUrl);

            holder.imageView.SetImageBitmap(autoCompleteImages[this.autocompleteSearches[position].PicUrl]);
        }