In our previous tutorials we learned how to display different products, add them to the cart, and even change the quantity of those products. Now we must add another crucial component, the price.

If you look back at the previous tutorials, our Product object already contains price information, and our initial catalog is setting prices--these prices simply are not being displayed in the app anywhere.

Step 2. Modify the productdetails.xml Layout

In theory, we could append the price to the product description, but we may want it to stand out a little more. To help accomplish this, we will add a separate view to the layout to put the pricing information.

It is actually not recommended to use decimals to calculate prices in Java applications. A better option would be to use the BigDecimal class.

------------------------------------------------------------

We create these tutorials in our free time. If you like what you see please consider buying us a cup of coffee so we can keep creating useful material. Click on the image below to make a donation via Paypal.

Hey i really liked the tutorial. Its so very perfect. But there is a flaw, Inside shopping cart if you press on a item it would be mapped to some other different item. I tried to correct it in the source code But was not successful. Please go through.

I found the same mistake. Maybe it's because we take the position of a product in the list. If product no. 3 in the catalog is the first product in the shopping cart, and in the shopping cart you click on this product, the product details of the product no. 1 in the catalog opens. But I haven't found a solution yet.

Thank you so much, this series of tutorials helped me a lot. After the second part of this tutorial everything was working ok, then I decided to implement this third part but unfortunately I'm really noob at developing Android Apps. At first it seemed like the productdetails.xml file had some syntax errors ( I just changed some lowercases and they disapeared ) The real problem was when I first started the application. The first activity (catalog) works but when I click on one item it suddently stops and android says unfortulately application has stopped. I also downloaded the source of second tutorial from github and updated the app with this tutorial but it seems like I'm missing something. Any suggestions are more than welcome. Sorry for the long post. (:

hii, can you please explain how to add values from multiple intents in same cart.Suppose i have 1 list of books as above and another list of some other item.I want that both selected books and other items should appear in same cart on doing add to cart button.Can you suggest how to do it ites urgent

Yes your absolutely right you can make a slide appear in JavaScript and presumably make a couple of other phenomenal things however your constrained by two components How long it takes you and to what extent it takes the end clients gadget (if its a cell phone or desktop). java