title: how to pass total value in textview using base adapter class in android
body: <p>At first time choosing price,qty values.i added all prices and show in totalamount as textview.up to now working fine. if i changed the qty values i can change automatically price value at that time i want change the total value in textview</p>
  
  <p>i try this code</p>
  
  <pre><code>     public class SelectedItem extends Activity  {
   private ListView lv;
      private CustomAdapter adapter;
      int tableid;
      String id;
  ArrayList&lt;String&gt; arr=new ArrayList&lt;String&gt;();
  ArrayList&lt;String&gt; price=new ArrayList&lt;String&gt;();
  ArrayList&lt;Bitmap&gt; image=new ArrayList&lt;Bitmap&gt;();
  Double amountvalue;
  TextView totalamount;
  Button order;
  String dtotalamount;
      protected void onCreate(Bundle savedInstanceState) {
  // TODO Auto-generated method stub
  super.onCreate(savedInstanceState);
  arr=getIntent().getStringArrayListExtra("itemname");
  price=getIntent().getStringArrayListExtra("itemprice");
  
  
  image=getIntent().getExtras().getParcelableArrayList("itemimage");
  
  setContentView(R.layout.selecteditem);
   lv = (ListView) findViewById(R.id.selecteditemlist);
   adapter = new CustomAdapter(this, arr,price,image);
   lv.setAdapter(adapter);
   amountvalue=CustomAdapter.x;
   System.out.println(amountvalue);
   totalamount=(TextView)findViewById(R.id.amount);
   totalamount.setText(String.valueOf(amountvalue));(here only i can display the total value...now i want change qty means total also will change)
   order=(Button)findViewById(R.id.order);
   order.setOnClickListener(new OnClickListener() {
  
      public void onClick(View v) {
          try
          {
              tableid=Login.tableid;
              id=Integer.toString(tableid);
              System.out.println(id);
              String x=amountvalue.toString();
                             public class SelectedItem extends Activity  {
   private ListView lv;
      private CustomAdapter adapter;
      int tableid;
      String id;
  ArrayList&lt;String&gt; arr=new ArrayList&lt;String&gt;();
  ArrayList&lt;String&gt; price=new ArrayList&lt;String&gt;();
  ArrayList&lt;Bitmap&gt; image=new ArrayList&lt;Bitmap&gt;();
  Double amountvalue;
  TextView totalamount;
  Button order;
  String dtotalamount;
  
    protected void onCreate(Bundle savedInstanceState) {
  // TODO Auto-generated method stub
  super.onCreate(savedInstanceState);
  arr=getIntent().getStringArrayListExtra("itemname");
  price=getIntent().getStringArrayListExtra("itemprice");
  
  
  image=getIntent().getExtras().getParcelableArrayList("itemimage");
  
  setContentView(R.layout.selecteditem);
   lv = (ListView) findViewById(R.id.selecteditemlist);
   adapter = new CustomAdapter(this, arr,price,image);
   lv.setAdapter(adapter);
   amountvalue=CustomAdapter.x;
   System.out.println(amountvalue);
   totalamount=(TextView)findViewById(R.id.amount);
   totalamount.setText(String.valueOf(amountvalue));
   order=(Button)findViewById(R.id.order);
   order.setOnClickListener(new OnClickListener() {
  
      public void onClick(View v) {
  
              tableid=Login.tableid;
              id=Integer.toString(tableid);
              System.out.println(id);
              String x=amountvalue.toString();
  
           }
               });
            }
            }
  </code></pre>
  
  <p>CustomAdapter.java</p>
  
  <pre><code>            public class CustomAdapter extends BaseAdapter {
  
  public static Double x = 0.0;
  public static Double z;
  ArrayList&lt;Integer&gt; selectprice = new ArrayList&lt;Integer&gt;();
  public static ArrayList&lt;String&gt; arr1 = new ArrayList&lt;String&gt;();
  public static ArrayList&lt;String&gt; itemprice = new ArrayList&lt;String&gt;();
  public static ArrayList&lt;Bitmap&gt; itemimage = new ArrayList&lt;Bitmap&gt;();
  ArrayList&lt;Integer&gt; total = new ArrayList&lt;Integer&gt;();
  public Context Context;
  private LayoutInflater inflater;
  
  HashMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();
  
  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 int getCount() {
      // TODO Auto-generated method stub
      return arr1.size();
  
  }
  
  public Object getItem(int position) {
      // TODO Auto-generated method stub
      return arr1.get(position);
  }
  
  public long getItemId(int position) {
      // TODO Auto-generated method stub
      return position;
  }
  
  public void clear() {
      arr1.clear();
  
  }
  
  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();
  
          holder.textViewSelectedText = (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();
      }
      @SuppressWarnings("unused")
      String amount = holder.qty.getText().toString();
      final Double price1 = Double.parseDouble(itemprice.get(position));
      int qut = Integer.parseInt(holder.qty.getText().toString());
      final 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() {
  
          @SuppressWarnings("static-access")
          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);
                  Double y = x - total;
                  double z = y + result;
  
              }
  
          }
  
      });
  
      return convertView;
  }
  
  class ViewHolder {
      TextView textViewSelectedText = null;
      TextView price = null;
      ImageView image = null;
      EditText qty = null;
      TextView total = null;
  }
  }
  </code></pre>
  
  <p>at first time x(customadapter) values can show in total. after changing the qty i will get z(customadapter) value. this z value i want pass total.. please any one can help me                      </p>