title: How to get the sum of a column in a listview android?
body: <p>I am trying to get the total of numbers in an sql table,
  i first connected between android and sql but i can't
  sum the numbers in the table column and show them
  in a textview,like i want to get the total
  of numbers in a column then
  display them in a text view
  ,can someone help me with this task?</p>
  
  <p>here is the code i used for
  the listview</p>
  
  <pre><code>public class MyAppAdapter extends BaseAdapter         //has a class viewholder which holds
      {
          public class ViewHolder
          {
              TextView textDate;
              TextView textTotal;
              TextView textLastTotal;
              TextView textCount;
              TextView textTaxs;
  
          }
  
          public List&lt;ClassListItems2&gt; parkingList;
  
          public Context context;
          ArrayList&lt;ClassListItems2&gt; arraylist;
  
          private MyAppAdapter(List&lt;ClassListItems2&gt; apps, Context context)
          {
              this.parkingList = apps;
              this.context = context;
              arraylist = new ArrayList&lt;ClassListItems2&gt;();
              arraylist.addAll(parkingList);
          }
  
          @Override
          public int getCount() {
              return parkingList.size();
          }
  
          @Override
          public Object getItem(int position) {
              return position;
          }
  
          @Override
          public long getItemId(int position) {
              return position;
          }
  
          @Override
          public View getView(final int position, View convertView, ViewGroup parent) // inflating the layout and initializing widgets
          {
  
              View rowView = convertView;
              ViewHolder viewHolder= null;
              if (rowView == null)
              {
                  LayoutInflater inflater = getLayoutInflater();
                  rowView = inflater.inflate(R.layout.listcontent2, parent, false);
                  viewHolder = new ViewHolder();
                  viewHolder.textDate = (TextView) rowView.findViewById(R.id.date);
                  viewHolder.textLastTotal = (TextView) rowView.findViewById(R.id.lasttotal);
                  viewHolder.textTaxs = (TextView) rowView.findViewById(R.id.date3);
                  viewHolder.textCount = (TextView) rowView.findViewById(R.id.InvoicescCount);
                  viewHolder.textTotal = (TextView) rowView.findViewById(R.id.total);
                  rowView.setTag(viewHolder);
              }
              else
              {
                  viewHolder = (ViewHolder) convertView.getTag();
              }
              // here setting up names and images
              viewHolder.textDate.setText(parkingList.get(position).getDate()+"");
              viewHolder.textTotal.setText(parkingList.get(position).getTotal());
              viewHolder.textLastTotal.setText(parkingList.get(position).getLasttotal());
              viewHolder.textTaxs.setText(parkingList.get(position).getTaxs());
              viewHolder.textCount.setText(parkingList.get(position).getInvoicecount());
  
  
  
  
  
              listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                  @Override
                  public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
                      //What happens when you click on a place!
  
  
  
                  }
              });
  
              return rowView;
          }
  </code></pre>