//Must override, this is the important one. This method is used to //bind our current data to your view holder. Think of this as the equivalent //of GetView for regular Adapters. public override async void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { var viewHolder = holder as CrewMemberItemViewHolder; var currentCrewMember = _crewMembers[position]; //Bind our data from our data source to our View References viewHolder.CrewMemberName.Text = currentCrewMember.Name; viewHolder.RankAndPosting.Text = String.Format("{0}\n{1}", currentCrewMember.Rank, currentCrewMember.Posting); var photoBitmap = await _imageManager.GetScaledDownBitmapFromResourceAsync(currentCrewMember.PhotoResourceId, 120, 120); viewHolder.CrewMemberPhoto.SetImageBitmap(photoBitmap); }
protected override async void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.CrewMemberProfile); _rank = FindViewById <TextView>(Resource.Id.crewMemberRankTextView); _name = FindViewById <TextView>(Resource.Id.crewMemberNameTextView); _position = FindViewById <TextView>(Resource.Id.crewMemberPositionTextView); _posting = FindViewById <TextView>(Resource.Id.crewMemberPostingTextView); _species = FindViewById <TextView>(Resource.Id.crewMemberSpeciesTextView); _biogaphy = FindViewById <TextView>(Resource.Id.crewMemberBioTextView); _photo = FindViewById <ImageView>(Resource.Id.crewMemberImageView); var index = Intent.GetIntExtra("index", -1); if (index < 0) { return; } var imageResourceId = Intent.GetIntExtra("imageResourceId", -1); var crewMember = SharedData.CrewManifest[index]; _rank.Text = crewMember.Rank; _name.Text = crewMember.Name; _position.Text = crewMember.Position; _posting.Text = crewMember.Posting; _species.Text = String.Format("Species: {0}", crewMember.Species); _biogaphy.Text = crewMember.Biography; var imageManager = new ImageManager(this.Resources); var bitmap = await imageManager.GetScaledDownBitmapFromResourceAsync(imageResourceId, 150, 150); _photo.SetImageBitmap(bitmap); }