title: how to delete an item from shopping cart by button click in android
body: <p>I can delete an item from shopping list through long press on the selected item by the following code</p>
  <pre><code>  listcart.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
             @Override
             public boolean onItemLongClick(AdapterView&lt;?&gt; adapterView, View view, int i, long l) {
  
  
                 model=d.get(i);
                 final String orderno=model.getOrderno();
                 AlertDialog.Builder msg=new AlertDialog.Builder(CartActivity.this)
                         .setTitle(&quot;Delete Item&quot;)
                         .setMessage(&quot;Are you sure delete this item &quot;+model.getItemname())
                         .setIcon(R.drawable.applogo)
                         .setPositiveButton(&quot;Yes&quot;, new DialogInterface.OnClickListener() {
                             @Override
                             public void onClick(DialogInterface dialogInterface,int i){
                                 DBLite db=new DBLite(CartActivity.this);
                                 db.DeleteItem(orderno);
                                 d=new ArrayList&lt;&gt;(db.GetCart(CartActivity.this));
                                 adapterCart=new Cart_Adapter(CartActivity.this,d);
                                 listcart.setAdapter(adapterCart);
                                 txtOrderTotal.setText(String.valueOf(db.GetSum()));
  
                             }
                         }).setNegativeButton(&quot;No&quot;,null);
                 msg.create();
                 msg.show();
                 return false;
             }
      });
  </code></pre>
  <p>I want to delete this item by clicking (x) image. How can I customize that code for that purpose, like the image below:</p>
  <p><img src="https://i.stack.imgur.com/ib15M.png" alt="screenshot from app" /></p>