title: android How to add quantity in the shopping cart?
body: <p>Hello I hope you are able to understand me, my English is not good, sorry
  , I have an <code>activity</code> that contains a <code>listview</code> of products,if you click is added to another activity shopping cart. So far so good. I have gotten that if you click 2 times an article, 2 same items will not be added in the shopping cart, but now I want to establish a method to show me the same item if I pressed 2 times, exit 2 in the quantity field , and the price multiply by two, logically.</p>
  
  <p>So insert the clicked item in the cart activity:<br>
  I created a variable that counts how many times an item was clicked,(contador)</p>
  
  <pre><code>case 0:
  if (page1 == null)
  {
         page1 = (ListView) LayoutInflater.from(Local_mostrar_bebidaActivity.this).inflate(R.layout.page_one_viewpager_listview, null);
         page1.setAdapter(adapterlistvMenuBEBIDAS);
         page1.setOnItemClickListener(new OnItemClickListener() {
         @Override
         public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id)                                  {
         ItemListView item = itemsListVMenuBEBIDAS.get(position);
         if (MiPedidoActivity.itemsListVMiPedido.contains(item)) { // &lt;- look for item!
         // ... item already in list
                 Log.i(LOGTAG, "Añadido item "+ contador+" "+ numUds);
                 ++contador;
                 numUds=contador;
      } 
          else {
                 MiPedidoActivity.itemsListVMiPedido.add(item);
                 contador= 1;
                 numUds=contador;
                 Log.i(LOGTAG, "Añadido item "+ contador+" "+ numUds);
           }});
  }
  page = page1;
  break;
  </code></pre>
  
  <p>I so add the products in the <code>arraylist</code></p>
  
  <pre><code>private static ArrayList&lt;ItemListView&gt; obtenerItemsMenuBEBIDAS() {
      ArrayList&lt;ItemListView&gt; itemsMenuBEBIDAS = new ArrayList&lt;ItemListView&gt;();
  
      itemsMenuBEBIDAS.add(new ItemListView(1, "Product1", "malta y z.", "drawable/a1","3.10",""+numUds));
  
      itemsMenuBEBIDAS.add(new ItemListView(3, "Cocacola", "Botellin de 22ml","drawable/cocacola_logo","1.75",""+ numUds));
      itemsMenuBEBIDAS.add(new ItemListView(4, "Cocacola Zero", "Botellin de 22ml","drawable/cocacola_zero","1.75",""+ numUds ));
  
      return itemsMenuBEBIDAS;
  }
  </code></pre>
  
  <p>(numUds) is a variable that I have created to know how many units have been clicked and then display the corresponding <code>textview</code></p>
  
  <p>Any idea?</p>