Android-----Shopping Cart (includes slide-slip removal, product screening, product increase and decrease, price calculation, store classification, etc.)

Source: Internet
Author: User

E-commerce projects often have shopping cart this function, do a lot of projects, have a different interface, choose one to talk about.

Mainly includes the store classification, side-by-side removal, product selection, increase and decrease, price calculation and other functions.

Look:

Important Code:

 Private voidShowexpanddata () {Cartexpandadapter=NewCartexpandadapter ( This, Cartexpandablelistview,cartinfo.getdata ());        Cartexpandablelistview.setadapter (Cartexpandadapter); intIntgroupcount =Cartexpandablelistview.getcount ();  for(inti=0; i<intgroupcount; i++) {cartexpandablelistview.expandgroup (i); }        /*** Select All*/Cartexpandadapter.setonitemclicklistener (NewOnviewitemclicklistener () {@Override Public voidOnitemclick (BooleanIsflang, view view,intposition)                {Cartinfo.getdata (). get (position). Setischeck (Isflang); intLength=cartinfo.getdata (). get (position). GetItems (). Size ();  for(inti = 0; i < length; i++) {cartinfo.getdata (). get (position). GetItems (). get (i). Setischeck (Isflang);                } cartexpandadapter.notifydatasetchanged ();            Showcommoditycalculation ();        }        }); /*** Radio*/Cartexpandadapter.setonclicklistentermodel (NewOnclicklistentermodel () {@Override Public voidOnitemclick (BooleanIsflang, view view,intOneposition,intposition)                {Cartinfo.getdata (). Get (Oneposition). GetItems (). get (position). Setischeck (Isflang); intLength=cartinfo.getdata (). Get (Oneposition). GetItems (). Size ();  for(inti = 0; i < length; i++) {                    if(!cartinfo.getdata (). Get (Oneposition). GetItems (). get (i). Ischeck ()) {                        if(!Isflang)                        {Cartinfo.getdata (). Get (Oneposition). Setischeck (Isflang);                        } cartexpandadapter.notifydatasetchanged ();                        Showcommoditycalculation (); return; }Else {                        if(i== (length-1) {cartinfo.getdata (). Get (Oneposition). Setischeck (Isflang);                        Cartexpandadapter.notifydatasetchanged ();            }}} showcommoditycalculation ();        }        }); Cartexpandadapter.setonclickdeletelistenter (NewOnclickdeletelistenter () {@Override Public voidOnitemclick (View view,intOneposition,intposition) {Toast.maketext (mainactivity). This, delete action, Toast.length_long). Show ();        }        }); /*** * Quantity increase and decrease*/Cartexpandadapter.setonclickaddcloselistenter (NewOnclickaddcloselistenter () {@Override Public voidOnitemclick (View view,intIndexintOneposition,intPositionintnum) {                if(index==1){                    if(num>1) {cartinfo.getdata (). Get (Oneposition). GetItems (). get (position). setnum (Num-1));                    Cartexpandadapter.notifydatasetchanged (); }                }Else{cartinfo.getdata (). Get (Oneposition). GetItems (). get (position). setnum (Num+ 1));                Cartexpandadapter.notifydatasetchanged ();            } showcommoditycalculation ();           }        }); }

This is the shopping cart used in my project, the basic functions have been.

The need of the boys, you can refer to.

Code Portal

Android-----Shopping Cart (includes slide-slip removal, product screening, product increase and decrease, price calculation, store classification, etc.)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.