예제 #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.ViewItem);
            myDB = new DBHelperClass(this);

            lv1 = FindViewById <ListView>(Resource.Id.listView1);
            sv1 = FindViewById <SearchView>(Resource.Id.searchView1);

            emailPrint = Intent.GetStringExtra("username");

            // Custom Adaptor Editing
            ICursor cs = myDB.SelectIteme();

            if (cs.MoveToFirst())
            {
                do
                {
                    string image = cs.GetString(cs.GetColumnIndexOrThrow("item_sub"));
                    int    im    = Convert.ToInt32(image);
                    myUsersList.Add(new UserObject(cs.GetString(cs.GetColumnIndexOrThrow("item_name")), cs.GetString(cs.GetColumnIndexOrThrow("email")),
                                                   cs.GetString(cs.GetColumnIndexOrThrow("description")), im));
                }while (cs.MoveToNext());
                {
                }
                cs.Close();
                // custom adapton code added
                MyCustomAdapterList myAdapter = new MyCustomAdapterList(this, myUsersList);
                lv1.Adapter          = myAdapter;
                lv1.ItemClick       += Lv1_ItemClick;
                sv1.QueryTextChange += Sv1_QueryTextChange;
            }
        }
예제 #2
0
 private void Sv1_QueryTextChange(object sender, SearchView.QueryTextChangeEventArgs e)
 {
     if (string.IsNullOrWhiteSpace(e.NewText))
     {
         MyCustomAdapterList myAdapter = new MyCustomAdapterList(this, myUsersList);
         lv1.Adapter = myAdapter;
     }
     else
     {
         MyCustomAdapterList myAdapter = new MyCustomAdapterList(this, myUsersList.Where(us => us.email.StartsWith(e.NewText)).ToList());
         lv1.Adapter = myAdapter;
     }
 }