private TextView footerSum;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_act_qperson);
// 取得页脚布局
View footer_view = LayoutInflater.from(this).inflate(R.layout.q_person_foot, null);
footerSum = (TextView) footer_view.findViewById(R.id.tFooterSum);
// addFooterView 每执行一次将添加一个页脚,执行多次将显示多个页脚
lvItems.addFooterView(footer_view);
c = db.rawQuery(sql, null);
if (c.getCount() > 0) {
c.moveToFirst();
int sum = 0;
for (int i = 0; i < c.getCount(); i++) {
sum += c.getInt(c.getColumnIndex("pay"));
c.moveToNext();
} ;
footerSum.setText(Integer.toString(sum));
}
myAdapter = new QPersonAdapter(actQperson.this, R.layout.q_person_item_in, c,
new String[]{"pay", "name", "shiyou", "sDate"},
new int[]{R.id.tZMPay, R.id.tZMName, R.id.tZMShiyou, R.id.tZMDate}, 0);
lvItems.setAdapter(myAdapter);
}