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));
}
i 开发者_开发百科want to get the value of the EditText value, to multiply with the selected sum value of the query
Try this,
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);
}
If they're integer values, try this:
int multiplierOne = Integer.parseInt(edite.getText().toString());
....
int multiplierTwo = sumw.getInt(0);
int product = multiplierOne * multiplierTwo;
editT.setText("" + product);
精彩评论