public RecyclerAdapter(ContactListAdapter <ContactList> Mitems, RecyclerView recyler) { this.Mitems = Mitems; NotifyDataSetChanged(); mrecyle = recyler; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); recyclerview = FindViewById <RecyclerView>(Resource.Id.recyclerview); List <ContactList> contact = new List <ContactList>(); contact.Add(new ContactList { ContactName = "Anbu", Number = "2564125624" }); contact.Add(new ContactList { ContactName = "Arun", Number = "52459878788" }); contact.Add(new ContactList { ContactName = "John", Number = "57879877878" }); contact.Add(new ContactList { ContactName = "Peter", Number = "56478989798" }); contact.Add(new ContactList { ContactName = "Ali", Number = "12345687945" }); ContactListitems = new ContactListAdapter <ContactList>(); foreach (var s in contact) { ContactListitems.Add(s); } recyclerview_layoutmanger = new LinearLayoutManager(this, LinearLayoutManager.Vertical, false); recyclerview.SetLayoutManager(recyclerview_layoutmanger); recyclerview_adapter = new RecyclerAdapter(ContactListitems, recyclerview); recyclerview.SetAdapter(recyclerview_adapter); }