title: adding items to listview from another activity
body: <p>I have my "Cart" listview that displays the items that were clicked from the main activity. I have also a listview in my mainactivity the displays all the items. Whenever I click "Buy", the item is successfully sent to the listview of the "Cart". then in my Cart activity, I have "ADD ITEMS" button that goes back to the MainActivity to add more items. If I click "Buy" once again, the item chosen is overwriting the existing item. </p>
  
  <p>Am I missing something?</p>
  
  <p>Here is my Cart.class</p>
  
  <pre><code>public class Cart extends MainActivity {
  
  ListView cartList;
  CartCustomAdapter cartCustomAdapter;
  String name, price;
  
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_cart);
  
      ArrayList&lt;Order&gt; cartArray = new ArrayList&lt;Order&gt;();
  
      Bundle bundle = getIntent().getExtras();
  
      Button checkout =  (Button) findViewById(R.id.check_out);
      Button add_item = (Button) findViewById(R.id.add_item);
  
      name = bundle.getString("i_name");
      price = bundle.getString("i_price");
  
      add_item.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              Intent intent = new Intent(Cart.this,MainActivity.class);
              startActivity(intent);
  
          }
      });
  
      cartArray.add(new Order(name,price,"1"));
  
      cartCustomAdapter = new CartCustomAdapter(Cart.this,R.layout.list_cart,cartArray);
      cartList = (ListView) findViewById(R.id.cart_list);
      cartList.setItemsCanFocus(false);
      cartList.setAdapter(cartCustomAdapter);
      cartCustomAdapter.notifyDataSetChanged();
  
  
  }
  </code></pre>
  
  <p>}</p>