Ejemplo n.º 1
0
        protected override void OnResume()
        {
            base.OnResume();
            var adapter = new StudentList(this, Student.students);

            listView.Adapter = adapter;
        }
Ejemplo n.º 2
0
        protected override void OnRestart()
        {
            base.OnRestart();
            //var adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, Student.students);
            var adapter = new StudentList(this, Student.students);

            listView.Adapter = adapter;
        }
Ejemplo n.º 3
0
        void searchViewQueryTextChange(object sender, SearchView.QueryTextChangeEventArgs e)
        {
            var            value      = e.NewText;
            List <Student> searchList = new List <Student>();

            foreach (Student aObj in Student.students)
            {
                if (aObj.fname.ToLower().Contains(value.ToLower()) || aObj.lname.ToLower().Contains(value.ToLower()))
                {
                    searchList.Add(aObj);
                }
            }
            var adapter = new StudentList(this, searchList);

            listView.SetAdapter(adapter);
        }
Ejemplo n.º 4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);

            listView   = FindViewById <ListView>(Resource.Id.listView1);
            searchView = FindViewById <SearchView>(Resource.Id.searchView1);
            var btn = FindViewById <Button>(Resource.Id.button1);

            btn.Click += delegate
            {
                Intent intent = new Intent(this, typeof(StudentInfo));
                StartActivity(intent);
            };

            var adapter = new StudentList(this, Student.students);

            listView.Adapter            = adapter;
            listView.ItemClick         += listItemSelected;
            searchView.QueryTextChange += searchViewQueryTextChange;
        }