public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.MusicListLayout, parent, false); MusicListViewHolder vh = new MusicListViewHolder(view, OnClick); return(vh); }
public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { MusicListViewHolder vh = holder as MusicListViewHolder; var item = items[position]; try { string AlbumImagePath = Path.Combine(ETC.CachePath, "Music", "Album", "Crop", $"{item.CodeName}.tsgp"); if (File.Exists(AlbumImagePath) == true) { vh.AlbumImage.SetImageDrawable(Android.Graphics.Drawables.Drawable.CreateFromPath(AlbumImagePath)); } vh.Name.Text = item.Name; vh.Artist.Text = item.Artist; } catch (Exception ex) { ETC.LogError(context, ex.ToString()); Toast.MakeText(context, "Error Create View", ToastLength.Short).Show(); } }