public override View GetView(int position, View convertView, ViewGroup parent) { Log.Info("getview", "GetView called"); PeopleListItem peopleListItem = (PeopleListItem)_peopleWidgetPopUp. GetListItem(position); var view = convertView; PeopleListAdapterViewHolder holder = null; if (view != null) { holder = view.Tag as PeopleListAdapterViewHolder; } if (holder == null) { holder = new PeopleListAdapterViewHolder(); var inflater = context.GetSystemService(Context.LayoutInflaterService). JavaCast <LayoutInflater>(); //replace with your item and your holder items //comment back in view = inflater.Inflate(Resource.Layout.peoplelistitem, parent, false); holder.Name = view.FindViewById <EditText>(Resource.Id.name); holder.Email = view.FindViewById <EditText>(Resource.Id.email); holder.Telephone = view.FindViewById <EditText>(Resource.Id.telephone); holder.Role = view.FindViewById <EditText>(Resource.Id.role); holder.ImageView = view.FindViewById <ImageView>(Resource.Id.imageView); view.Tag = holder; SetViewFunctionality(holder, position); } //fill in your items //holder.Title.Text = "new text here"; if (peopleListItem != null) { holder.Name.Text = peopleListItem.Name; holder.Email.Text = peopleListItem.Email; holder.Telephone.Text = peopleListItem.Telephone; holder.Role.Text = peopleListItem.RoleDescription; if (peopleListItem.Bitmap != null) { holder.ImageView.SetImageBitmap(peopleListItem.Bitmap); } } return(view); }
private void SetViewFunctionality(PeopleListAdapterViewHolder holder, int position) { holder.Name.SetOnKeyListener(this); holder.Email.SetOnKeyListener(this); holder.Telephone.SetOnKeyListener(this); holder.Role.SetOnKeyListener(this); holder.ImageView.Click += OnImageViewClick; holder.Name.SetTag(Resource.Id.addPerson, (Java.Lang.Object) "name"); holder.Email.SetTag(Resource.Id.addPerson, (Java.Lang.Object) "email"); holder.Telephone.SetTag(Resource.Id.addPerson, (Java.Lang.Object) "telephone"); holder.Role.SetTag(Resource.Id.addPerson, (Java.Lang.Object) "role"); holder.Name.SetTag(Resource.Id.backgroundLayout, position); holder.Email.SetTag(Resource.Id.backgroundLayout, position); holder.Telephone.SetTag(Resource.Id.backgroundLayout, position); holder.Role.SetTag(Resource.Id.backgroundLayout, position); }