protected void cal() {
// TODO Auto-generated method stub
Company obj1 = new Company();
String val1 = obj1.getCompanyID();
edite.getText().toString();
Cursor sumw = dbObject.rawQuery(
"SELECT sum(Volume)FROM SHARE WHERE _id2 LIKE ?",
new String[] { "%" + val1 + "%" });
sumw.moveToFirst();
editT.setText(sumw.getString(0));
}
我想获取EditText值的值,乘以查询的选定总和值
答案 0 :(得分:2)
试试这个,
protected void cal() {
// TODO Auto-generated method stub
Company obj1 = new Company();
String val1 = obj1.getCompanyID();
int n = Integer.parseInt(edite.getText().toString());
Cursor sumw = dbObject.rawQuery(
"SELECT sum(Volume)FROM SHARE WHERE _id2 LIKE ?",
new String[] { "%" + val1 + "%" });
sumw.moveToFirst();
editT.setText(sumw.getString(0)*n);
}
答案 1 :(得分:0)
如果它们是整数值,请尝试:
int multiplierOne = Integer.parseInt(edite.getText().toString());
....
int multiplierTwo = sumw.getInt(0);
int product = multiplierOne * multiplierTwo;
editT.setText("" + product);