所有插入PaymentPaid(editText)的值应为sum并显示为totalamt(Edittext)。 “
Next.setOnClickListener(new View.OnClickListener(){
public void onClick(View arg0) {
try {
String sql= Select-------?
String amntpaid=PaymentPaid.getText().toString();
String totamnt=totalamt.getText().toString();
}
catch (Exception e) {
e.printStackTrace();
}
}
});`
答案 0 :(得分:2)
试试这个.......
int subtotal = 0;
int total =0;
Cursor cursor = dh.rawQuery("SELECT _column_name FROM table_name WHERE _column_name LIKE ? ", new String[] {"%"});
if(cursor.moveToFirst())
do{
subtotal = cursor.getInt(cursor.getColumnIndex("_column_name"));
total = total+subtotal;
}while(cursor.moveToNext());
total_show_edttxt.setext(total);