Example #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.WarToy);
            Bitmap nerf = Android.Graphics.BitmapFactory.DecodeResource(Application.Context.Resources, Resource.Drawable.nerfg);
            Bitmap sol  = Android.Graphics.BitmapFactory.DecodeResource(Application.Context.Resources, Resource.Drawable.sol);
            Bitmap tank = Android.Graphics.BitmapFactory.DecodeResource(Application.Context.Resources, Resource.Drawable.Tank);


            WarToy St1 = new WarToy("1", "Nerf", 100, Helper.BitmapToBase64(nerf), 3, "Gun");
            WarToy St2 = new WarToy("2", "soldiers", 75, Helper.BitmapToBase64(sol), 3, "Gun");
            WarToy St3 = new WarToy("3", "Tank", 50, Helper.BitmapToBase64(tank), 3, "Cannon");

            //phase 2 - add to array list
            WarToyList = new System.Collections.Generic.List <WarToy>();
            WarToyList.Add(St1);
            WarToyList.Add(St2);
            WarToyList.Add(St3);
            //phase 3 - create adapter
            WarToyAdapter = new WarToyAdapter(this, WarToyList);
            //phase 4 reference to listview
            iv = FindViewById <ImageView>(Resource.Id.iv);

            lv                         = FindViewById <ListView>(Resource.Id.lv);
            lv.Adapter                 = WarToyAdapter;
            lv.OnItemClickListener     = this; //update
            lv.OnItemLongClickListener = this; //delete
            // Create your application here
        }
Example #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.updateamount);
            // Create your application here
            ivProduct      = FindViewById <ImageView>(Resource.Id.ivProduct);
            tvTitle        = FindViewById <TextView>(Resource.Id.tvTitle);
            tvAge          = FindViewById <TextView>(Resource.Id.tvprudactid);
            tvPrice        = FindViewById <TextView>(Resource.Id.tvPrice);
            tvpayment      = FindViewById <TextView>(Resource.Id.tvpayment);
            etamount       = FindViewById <EditText>(Resource.Id.etamount);
            btnaddtomylist = FindViewById <Button>(Resource.Id.btnaddtomylist);
            btnaddtomylist.SetOnClickListener(this);
            btncalculate = FindViewById <Button>(Resource.Id.btncalculate);
            btncalculate.SetOnClickListener(this);
            btncancle = FindViewById <Button>(Resource.Id.btncancle);
            btncancle.SetOnClickListener(this);
            pos  = Intent.GetIntExtra("pos", -1);
            pos1 = Intent.GetIntExtra("pos1", -1);
            pos2 = Intent.GetIntExtra("pos2", -1);
            if (pos != -1)
            {
                temp = SportToyActivity.SporttoyList[pos];
                pw   = temp.GetPic();
                // ivProduct.SetImageBitmap(Android.Graphics.BitmapFactory.DecodeResource(Application.Context.Resources, temp.GetPic()));
                tvAge.Text     = temp.GetAge().ToString();
                tvTitle.Text   = temp.GetName();
                tvPrice.Text   = temp.GetPrice().ToString();
                tvpayment.Text = "0";
            }
            else if (pos1 != -1)
            {
                temp1 = WarToyActivity.WarToyList[pos1];
                pw    = temp1.GetPic();
                // ivProduct.SetImageBitmap(Android.Graphics.BitmapFactory.DecodeResource(Application.Context.Resources, temp1.GetPic()));
                tvAge.Text     = temp1.GetAge().ToString();
                tvTitle.Text   = temp1.GetName();
                tvPrice.Text   = temp1.GetPrice().ToString();
                tvpayment.Text = "0";
            }
            else if (pos2 != -1)
            {
                temp2 = BoxGamesActivity.boxgamesList[pos2];
                pw1   = temp2.GetPic();
                //  ivProduct = Android.Graphics.BitmapFactory.DecodeResource(Application.Context.Resources, Helper.Base64ToBitmap(pw1));
                tvAge.Text     = temp2.GetAge().ToString();
                tvTitle.Text   = temp2.GetName();
                tvPrice.Text   = temp2.GetPrice().ToString();
                tvpayment.Text = "0";
            }

            /*pw = temp.GetPic();
             * ivProduct.SetImageBitmap(Android.Graphics.BitmapFactory.DecodeResource(Application.Context.Resources, temp.GetPic()));
             * tvAge.Text = temp.GetAge().ToString();
             * tvTitle.Text = temp.GetName();
             * tvPrice.Text = temp.GetPrice().ToString();
             * tvpayment.Text = "0";*/
        }
Example #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.WarToy);
            Bitmap nerf  = Android.Graphics.BitmapFactory.DecodeResource(Application.Context.Resources, Resource.Drawable.nerfg);
            Bitmap sol   = Android.Graphics.BitmapFactory.DecodeResource(Application.Context.Resources, Resource.Drawable.sol);
            Bitmap tank  = Android.Graphics.BitmapFactory.DecodeResource(Application.Context.Resources, Resource.Drawable.Tank);
            Bitmap lego  = Android.Graphics.BitmapFactory.DecodeResource(Application.Context.Resources, Resource.Drawable.lego);
            Bitmap plain = Android.Graphics.BitmapFactory.DecodeResource(Application.Context.Resources, Resource.Drawable.plain);
            Bitmap ship  = Android.Graphics.BitmapFactory.DecodeResource(Application.Context.Resources, Resource.Drawable.ship);
            Bitmap robo  = Android.Graphics.BitmapFactory.DecodeResource(Application.Context.Resources, Resource.Drawable.robotrick);
            WarToy St1   = new WarToy("1", "Nerf", 100, Helper.BitmapToBase64(nerf), 3, "Gun");
            WarToy St2   = new WarToy("2", "soldiers", 75, Helper.BitmapToBase64(sol), 3, "Gun");
            WarToy St3   = new WarToy("3", "Tank", 50, Helper.BitmapToBase64(tank), 3, "Cannon");
            WarToy St4   = new WarToy("20", "lego", 60, Helper.BitmapToBase64(lego), 3, "starwars");
            WarToy St5   = new WarToy("21", "plain", 70, Helper.BitmapToBase64(plain), 3, "air");
            WarToy St6   = new WarToy("22", "ship", 99, Helper.BitmapToBase64(ship), 3, "war");
            WarToy St7   = new WarToy("3", "robo", 50, Helper.BitmapToBase64(robo), 3, "trick");

            //phase 2 - add to array list
            WarToyList = new System.Collections.Generic.List <WarToy>();
            WarToyList.Add(St1);
            WarToyList.Add(St2);
            WarToyList.Add(St3);
            WarToyList.Add(St4);
            WarToyList.Add(St5);
            WarToyList.Add(St6);
            WarToyList.Add(St7);
            //phase 3 - create adapter
            WarToyAdapter = new WarToyAdapter(this, WarToyList);
            //phase 4 reference to listview
            iv = FindViewById <ImageView>(Resource.Id.iv);

            lv                     = FindViewById <ListView>(Resource.Id.lv);
            lv.Adapter             = WarToyAdapter;
            lv.OnItemClickListener = this;     //update

            // Create your application here
        }