When Quantity of the item is changed the Total Amount has to change in Android?
<p>I am new to Android. In my Apps, there is a ItemName, Rate, Quantity and Price in a ListView. Default Quantity is 1 and it is in a EditText. and at last i have given a Total Amount. Price is getting calculated correctly when the Quantity is changed.. Intially the Total Amount is also correctly displayed. My Problem here is the Total Amount of the Items is not calculated correctly after changing the Quantity of the Item..</p>

<p>Here is my Code:</p>

<pre><code>public CustomAdapter(Context context, ArrayList&lt;String&gt; arr,ArrayList&lt;String&gt;        price,ArrayList&lt;Bitmap&gt; image) 
    {
    Context=context;
    inflater=LayoutInflater.from(context);
    arr1=arr;
    itemprice=price;

    itemimage=image;
    System.out.println(itemprice);
    System.out.println("arr: " + arr.size());

    for(int i=0;i&lt;price.size();i++)
    {

        x=x+Double.parseDouble(price.get(i));


    }

   }

    public View getView(final int position, View convertView, ViewGroup parent) 
    {


      final  ViewHolder holder;

        if (convertView == null) 
        {
            convertView = inflater.inflate(R.layout.selecteditemlistview, null);
            holder = new ViewHolder();

            (TextView)convertView.findViewById(R.id.selectedtext);
            holder.price=(TextView)convertView.findViewById(R.id.selectitemprice);
            holder.image=(ImageView)convertView.findViewById(R.id.selectitemimage);
            holder.qty=(EditText)convertView.findViewById(R.id.selectqty);
            holder.total=(TextView)convertView.findViewById(R.id.price);

            convertView.setTag(holder);
        }
        else 
        {
            holder = (ViewHolder) convertView.getTag();
        }
        String amount=holder.qty.getText().toString();
        final Double price1=Double.parseDouble(itemprice.get(position));
        int qut=Integer.parseInt(holder.qty.getText().toString());
        Double total=(price1*qut);
        holder.textViewSelectedText.setText(arr1.get(position));
        holder.price.setText(itemprice.get(position));
        holder.image.setImageBitmap(itemimage.get(position));
        holder.total.setText(String.valueOf(total));




      holder.qty.setOnFocusChangeListener(new OnFocusChangeListener() {

        public void onFocusChange(View v, boolean hasFocus) {
            // TODO Auto-generated method stub
            if(!hasFocus)
            {

                 int position = v.getId();      
                final EditText Caption = (EditText) v;
                Caption.setFocusable(true); 
                holder.qty.setFocusable(true);
                int q=Integer.parseInt(holder.qty.getText().toString());
                Double result=(price1 * q);
                System.out.println(result);

                holder.total.setText(String.valueOf(result));

            }
        }
    });


        return convertView;     
       }

      }
</code></pre>

<p>Please help me to solve my problem.. Thanks in Advance.</p>
