Exemplo n.º 1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            //SetContentView (Resource.Layout.Main);

            #region //persons に追加
            persons.Add(new Person { Name = "Alen", ImageResourceId = Resource.Drawable.A });
            persons.Add(new Person { Name = "Brawn", ImageResourceId = Resource.Drawable.B });
            persons.Add(new Person { Name = "Charie", ImageResourceId = Resource.Drawable.C });
            persons.Add(new Person { Name = "Danny", ImageResourceId = Resource.Drawable.D });
            persons.Add(new Person { Name = "Eric", ImageResourceId = Resource.Drawable.E });
            persons.Add(new Person { Name = "Alen2", ImageResourceId = Resource.Drawable.A });
            persons.Add(new Person { Name = "Brawn2", ImageResourceId = Resource.Drawable.B });
            persons.Add(new Person { Name = "Charie2", ImageResourceId = Resource.Drawable.C });
            persons.Add(new Person { Name = "Danny2", ImageResourceId = Resource.Drawable.D });
            persons.Add(new Person { Name = "Eric2", ImageResourceId = Resource.Drawable.E });
            persons.Add(new Person { Name = "Alen3", ImageResourceId = Resource.Drawable.A });
            persons.Add(new Person { Name = "Brawn3", ImageResourceId = Resource.Drawable.B });
            persons.Add(new Person { Name = "Charie3", ImageResourceId = Resource.Drawable.C });
            persons.Add(new Person { Name = "Danny3", ImageResourceId = Resource.Drawable.D });
            persons.Add(new Person { Name = "Eric3", ImageResourceId = Resource.Drawable.E });
            persons.Add(new Person { Name = "Alen4", ImageResourceId = Resource.Drawable.A });
            persons.Add(new Person { Name = "Brawn4", ImageResourceId = Resource.Drawable.B });
            persons.Add(new Person { Name = "Charie4", ImageResourceId = Resource.Drawable.C });
            persons.Add(new Person { Name = "Danny4", ImageResourceId = Resource.Drawable.D });
            persons.Add(new Person { Name = "Eric4", ImageResourceId = Resource.Drawable.E });
            persons.Add(new Person { Name = "Alen5", ImageResourceId = Resource.Drawable.A });
            persons.Add(new Person { Name = "Brawn5", ImageResourceId = Resource.Drawable.B });
            persons.Add(new Person { Name = "Charie5", ImageResourceId = Resource.Drawable.C });
            persons.Add(new Person { Name = "Danny5", ImageResourceId = Resource.Drawable.D });
            persons.Add(new Person { Name = "Eric5", ImageResourceId = Resource.Drawable.E });
            #endregion

            ListAdapter = new CustomListViewAdapter(this, persons);
        }
Exemplo n.º 2
0
 private void GetAdapter()
 {
     if (_weatherList != null)
     {
         _newAdapter = new CustomListViewAdapter(this, _weatherList);
     }
 }
        public void ConfigureListView()
        {
            CustomListViewAdapter adapter = new CustomListViewAdapter(this, Tables);
            var lv = FindViewById <ListView>(Resource.Id.listView);

            lv.Adapter    = adapter;
            lv.ItemClick += (s, e) =>
            {
                Intent intent = new Intent(this, typeof(TableActivity));
                intent.PutExtra("table_nr", e.Position);
                StartActivity(intent);
            };
        }
        public int ConfigureListView()
        {
            var total = FindViewById <TextView>(Resource.Id.total);
            CustomListViewAdapter adapter = new CustomListViewAdapter(this, MainActivity.CurrentOrder);
            var lv = FindViewById <ListView>(Resource.Id.lvOrder);

            lv.Adapter = adapter;
            int sum = 0;

            for (int i = 0; i < lv.Count; i++)
            {
                sum += adapter.GetPrice(i) * adapter.GetQuantity(i);
            }
            total.Text = "Total: " + sum + " RON";
            return(sum);
        }