public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { ClothingViewHolder vh = holder as ClothingViewHolder; Clothing item = _clothing.FindAll(MatchPredicate)[position]; if (vh != null) { vh.Clothing = item; try { Stream stream = vh.ItemView.Context.Assets.Open(item.Image); Drawable d = Drawable.CreateFromStream(stream, null); stream.Close(); vh.ImageView.SetImageDrawable(d); d.Dispose(); } catch (FileNotFoundException) { vh.ImageView.SetImageResource(Resource.Drawable.ic_notification_sync_problem); } vh.NameView.Text = item.Name; vh.PriceView.Text = item.FormattedPrice; } }
public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { View itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.ClothingCardView, parent, false); ClothingViewHolder vh = new ClothingViewHolder(itemView); return(vh); }