public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { View itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.activity_hitung_gizi_riwayat_item, parent, false); RiwayatHitungAdapterViewHolder vh = new RiwayatHitungAdapterViewHolder(itemView); return(vh); }
public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { RiwayatHitungAdapterViewHolder vh = holder as RiwayatHitungAdapterViewHolder; vh.tvTanggal.Text = riwayatGizi[position].Tanggal.ToString(); vh.tvKebutuhanHarian.Text = riwayatGizi[position].Energi.ToString(); holder.ItemView.Click += (sender, e) => { Intent intentHitungGizi = new Intent(holder.ItemView.Context, typeof(ActivityHitungGiziHasil)); intentHitungGizi.PutExtra("frekuensi", riwayatGizi[position].Frekuensi); intentHitungGizi.PutExtra("energi", riwayatGizi[position].Energi); intentHitungGizi.PutExtra("karbohidrat", riwayatGizi[position].Karbohidrat); intentHitungGizi.PutExtra("protein", riwayatGizi[position].Protein); intentHitungGizi.PutExtra("lemak", riwayatGizi[position].Lemak); holder.ItemView.Context.StartActivity(intentHitungGizi); }; }