示例#1
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View myView = inflater.Inflate(Resource.Layout.Tab3, container, false);

            listView = myView.FindViewById <ListView>(Resource.Id.listViewID);

            spinnerView = myView.FindViewById <Spinner>(Resource.Id.spinnerViewID);

            clothingImage = myView.FindViewById <Spinner>(Resource.Id.groceryImageID);

            submit        = myView.FindViewById <Button>(Resource.Id.MyButton);
            submit.Click += delegate {
                AlertDialog.Builder alertDiag = new AlertDialog.Builder(context);
                alertDiag.SetTitle("Confirm ");
                alertDiag.SetMessage("ADD TO LIST");
                alertDiag.SetPositiveButton("ADD", (senderAlert, args) => {
                    int itemImageInfo    = selectedItemImage;
                    int itemQuantityInfo = selectedItemQuantity;

                    UserInfoDB newObj   = new UserInfoDB();
                    newObj.itemquantity = itemQuantityInfo;
                    newObj.itemimage    = itemImageInfo;


                    realmDB.Write(() =>
                    {
                        realmDB.Add(newObj);
                    });


                    myOwnList        = getDataFromRealmDB();
                    myAdapter        = new MyCustomAdapter(context, myOwnList);
                    listView.Adapter = myAdapter;
                    var toast        = Toast.MakeText(context, "ADDED SUCCESSFULLY", ToastLength.Short);
                    toast.Show();
                });
                alertDiag.SetNegativeButton("Cancel", (senderAlert, args) => {
                    alertDiag.Dispose();
                });
                Dialog diag = alertDiag.Create();
                diag.Show();
            };

            //Set Adapters:
            ArrayAdapter arrayAdapter = new ArrayAdapter(context, Android.Resource.Layout.SimpleExpandableListItem1, itemQuantity);

            spinnerView.Adapter       = arrayAdapter;
            spinnerView.ItemSelected += spinner_ItemSelected;

            myclothingItemImageList = getclothingItemImage();

            ItemImageAdapter itemimageAdapter = new ItemImageAdapter(context, myclothingItemImageList);

            clothingImage.Adapter       = itemimageAdapter;
            clothingImage.ItemSelected += clothingImage_ItemSelected;

            return(myView);
        }
示例#2
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View myView = inflater.Inflate(Resource.Layout.Tab2, container, false);

            listView = myView.FindViewById <ListView>(Resource.Id.listViewID);



            myOwnList        = getDataFromRealmDB();
            myAdapter        = new MyCustomAdapter(context, myOwnList);
            listView.Adapter = myAdapter;



            return(myView);
        }